diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-10-09 13:26:28 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-10-09 13:26:28 -0400 |
| commit | 074cf22ad462eafe963e4a749b2b74cab51211a1 (patch) | |
| tree | e1d7f938f2d949cc5dcf67ca648f200663e36562 /examples/http/http.tm | |
| parent | 47fca946065508cff4151a32b3008c161983fd9d (diff) | |
Change function syntax from `func(args)->ret` to `func(args -> ret)`
Diffstat (limited to 'examples/http/http.tm')
| -rw-r--r-- | examples/http/http.tm | 10 |
1 files changed, 5 insertions, 5 deletions
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(): |
