From 074cf22ad462eafe963e4a749b2b74cab51211a1 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 9 Oct 2024 13:26:28 -0400 Subject: Change function syntax from `func(args)->ret` to `func(args -> ret)` --- examples/http/http.tm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/http') diff --git a/examples/http/http.tm b/examples/http/http.tm index a4ded7d7..a1bcccc6 100644 --- a/examples/http/http.tm +++ b/examples/http/http.tm @@ -7,7 +7,7 @@ struct HTTPResponse(code:Int, body:Text) enum _Method(GET, POST, PUT, PATCH, DELETE) -func _send(method:_Method, url:Text, data:Text?, headers=[:Text])->HTTPResponse: +func _send(method:_Method, url:Text, data:Text?, headers=[:Text] -> HTTPResponse): chunks := @[:Text] save_chunk := func(chunk:CString, size:Int64, n:Int64): chunks:insert(inline C:Text { @@ -69,16 +69,16 @@ func _send(method:_Method, url:Text, data:Text?, headers=[:Text])->HTTPResponse: } return HTTPResponse(code, "":join(chunks)) -func get(url:Text, headers=[:Text])->HTTPResponse: +func get(url:Text, headers=[:Text] -> HTTPResponse): return _send(GET, url, !Text, headers) -func post(url:Text, data="", headers=["Content-Type: application/json", "Accept: application/json"])->HTTPResponse: +func post(url:Text, data="", headers=["Content-Type: application/json", "Accept: application/json"] -> HTTPResponse): return _send(POST, url, data, headers) -func put(url:Text, data="", headers=["Content-Type: application/json", "Accept: application/json"])->HTTPResponse: +func put(url:Text, data="", headers=["Content-Type: application/json", "Accept: application/json"] -> HTTPResponse): return _send(PUT, url, data, headers) -func delete(url:Text, data=!Text, headers=["Content-Type: application/json", "Accept: application/json"])->HTTPResponse: +func delete(url:Text, data=!Text, headers=["Content-Type: application/json", "Accept: application/json"] -> HTTPResponse): return _send(DELETE, url, data, headers) func main(): -- cgit v1.2.3