aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/net/http/client.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/world/net/http/client.lux')
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux26
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index 2decbe412..c23b58b95 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -36,13 +36,13 @@
(! (Try (//.Response !))))
request)))
-(def: method_function
+(def method_function
(syntax (_ [[_ name] <code>.symbol])
(in (list (code.local (text.replaced "#" "" (text.lower_cased name)))))))
(with_template [<method>]
[(with_expansions [<name> (method_function <method>)]
- (def: .public (<name> url headers data client)
+ (def .public (<name> url headers data client)
(All (_ !)
(-> URL //.Headers (Maybe Binary) (Client !)
(! (Try (//.Response !)))))
@@ -59,14 +59,14 @@
[//.#Trace]
)
-(def: default_buffer_size
+(def default_buffer_size
(n.* 1,024 1,024))
-(def: empty_body
+(def empty_body
[Nat Binary]
[0 (binary.empty 0)])
-(def: (body_of data)
+(def (body_of data)
(-> Binary [Nat Binary])
[(binary.size data) data])
@@ -109,7 +109,7 @@
(new [java/io/InputStream])
(read [[byte] int int] "io" "try" int))
- (def: jvm_method
+ (def jvm_method
(-> //.Method Text)
(|>> (pipe.case
{//.#Post} "POST"
@@ -122,7 +122,7 @@
{//.#Options} "OPTIONS"
{//.#Trace} "TRACE")))
- (def: (default_body input)
+ (def (default_body input)
(-> java/io/BufferedInputStream (//.Body IO))
(|>> (maybe#each (|>> [true]))
(maybe.else [false ..default_buffer_size])
@@ -172,7 +172,7 @@
(again (i.+ bytes_read so_far)
output))))))))))
- (def: (default_headers connection)
+ (def (default_headers connection)
(-> java/net/HttpURLConnection (IO (Try //.Headers)))
(loop (again [index +0
headers //.empty])
@@ -188,10 +188,10 @@
{.#None}
(in headers)))))
- (def: .public default
+ (def .public default
(Client IO)
(implementation
- (def: (request method url headers data)
+ (def (request method url headers data)
(is (IO (Try (//.Response IO)))
(do [! (try.with io.monad)]
[connection (|> url ffi.as_string java/net/URL::new java/net/URL::openConnection)
@@ -224,10 +224,10 @@
@.jvm (these <jvm>)
(these)))
-(def: .public (async client)
+(def .public (async client)
(-> (Client IO) (Client Async))
(implementation
- (def: (request method url headers data)
+ (def (request method url headers data)
(|> (at client request method url headers data)
async.future
(at async.monad each
@@ -241,6 +241,6 @@
{try.#Failure error}
{try.#Failure error})))))))
-(def: .public headers
+(def .public headers
(-> (List [Text Text]) //.Headers)
(dictionary.of_list text.hash))