aboutsummaryrefslogtreecommitdiff
path: root/examples/http-server/http-server.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-02 16:18:06 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-02 16:18:06 -0400
commit639de3e5df6af1ed236cf1b849bbcf0894c7d8ad (patch)
treedc7427735a2b60ef0ae34fb92f2761368b2533ff /examples/http-server/http-server.tm
parent6ec8f20fc506af4af5513803fb9a708e4f7b5040 (diff)
Update table syntax
Diffstat (limited to 'examples/http-server/http-server.tm')
-rw-r--r--examples/http-server/http-server.tm6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/http-server/http-server.tm b/examples/http-server/http-server.tm
index ad489594..4cdbda4e 100644
--- a/examples/http-server/http-server.tm
+++ b/examples/http-server/http-server.tm
@@ -82,7 +82,7 @@ struct HTTPRequest(method:Text, path:Text, version:Text, headers:[Text], body:Te
body := rest[-1]
return HTTPRequest(method, path, version, headers, body)
-struct HTTPResponse(body:Text, status=200, content_type="text/plain", headers={:Text,Text}):
+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 ""
@@ -123,8 +123,8 @@ enum RouteEntry(ServeFile(file:Path), Redirect(destination:Text)):
is Redirect(destination):
return HTTPResponse("Found", 302, headers={"Location"=destination})
-func load_routes(directory:Path -> {Text,RouteEntry}):
- routes := &{:Text,RouteEntry}
+func load_routes(directory:Path -> {Text=RouteEntry}):
+ routes := &{:Text=RouteEntry}
for file in (directory ++ (./*)):glob():
skip unless file:is_file()
contents := file:read() or skip