From 3406515a44b13d0c290c28ac42bd364ce27560c7 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 6 Apr 2025 22:26:12 -0400 Subject: Make string escapes more normal: "\n" for newline, etc. Backticks can be used to put in literal code without escape sequences. --- examples/http-server/http-server.tm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/http-server') diff --git a/examples/http-server/http-server.tm b/examples/http-server/http-server.tm index 3d72c1e8..5b73d1af 100644 --- a/examples/http-server/http-server.tm +++ b/examples/http-server/http-server.tm @@ -85,14 +85,14 @@ struct HTTPRequest(method:Text, path:Text, version:Text, headers:[Text], body:Te struct HTTPResponse(body:Text, status=200, content_type="text/plain", headers:{Text=Text}={}) func bytes(r:HTTPResponse -> [Byte]) body_bytes := r.body.bytes() - extra_headers := (++: "$k: $v$(\r\n)" for k,v in r.headers) or "" + extra_headers := (++: "$k: $v\r\n" for k,v in r.headers) or "" return " - HTTP/1.1 $(r.status) OK$\r - Content-Length: $(body_bytes.length + 2)$\r - Content-Type: $(r.content_type)$\r - Connection: close$\r + HTTP/1.1 $(r.status) OK\r + Content-Length: $(body_bytes.length + 2)\r + Content-Type: $(r.content_type)\r + Connection: close\r $extra_headers - $\r$\n + \r\n ".bytes() ++ body_bytes func _content_type(file:Path -> Text) -- cgit v1.2.3