Allow http-conn-send! to take a procedure as its #:data parameter
original commit: ec0468a1f1
This commit is contained in:
parent
ab575666ce
commit
3b984b6566
|
@ -74,7 +74,7 @@ Closes the output side of @racket[hc], if it is live.
|
|||
[#:close? close? boolean? #f]
|
||||
[#:headers headers (listof (or/c bytes? string?)) empty]
|
||||
[#:content-decode decodes (listof symbol?) '(gzip)]
|
||||
[#:data data (or/c false/c bytes? string?) #f])
|
||||
[#:data data (or/c false/c bytes? string? data-procedure/c) #f])
|
||||
void?]{
|
||||
|
||||
Sends an HTTP request to @racket[hc] to the URI @racket[uri] using
|
||||
|
@ -82,6 +82,11 @@ HTTP version @racket[version] the method @racket[method] and the
|
|||
additional headers given in @racket[headers] and the additional data
|
||||
@racket[data].
|
||||
|
||||
If @racket[data] is a procedure, it will be called once with a
|
||||
procedure of one argument, which is a @racket[string] or
|
||||
@racket[byte-string] to be written to the request body using
|
||||
chunked transfer encoding.
|
||||
|
||||
If @racket[headers] does not contain an @litchar{Accept-Encoding}
|
||||
header, then a header indicating that encodings from @racket[decodes]
|
||||
are accepted is automatically added.
|
||||
|
@ -117,7 +122,7 @@ to do so.
|
|||
[#:version version (or/c bytes? string?) #"1.1"]
|
||||
[#:method method (or/c bytes? string? symbol?) #"GET"]
|
||||
[#:headers headers (listof (or/c bytes? string?)) empty]
|
||||
[#:data data (or/c false/c bytes? string?) #f]
|
||||
[#:data data (or/c false/c bytes? string? data-procedure/c) #f]
|
||||
[#:content-decode decodes (listof symbol?) '(gzip)]
|
||||
[#:close? close? boolean? #f])
|
||||
(values bytes? (listof bytes?) input-port?)]{
|
||||
|
@ -132,7 +137,7 @@ Calls @racket[http-conn-send!] and @racket[http-conn-recv!] in sequence.
|
|||
[#:version version (or/c bytes? string?) #"1.1"]
|
||||
[#:method method (or/c bytes? string? symbol?) #"GET"]
|
||||
[#:headers headers (listof (or/c bytes? string?)) empty]
|
||||
[#:data data (or/c false/c bytes? string?) #f]
|
||||
[#:data data (or/c false/c bytes? string? data-procedure/c) #f]
|
||||
[#:content-decode decodes (listof symbol?) '(gzip)])
|
||||
(values bytes? (listof bytes?) input-port?)]{
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ mapping is the empty list (i.e., no proxies).}
|
|||
@defproc[(http-sendrecv/url [u url?]
|
||||
[#:method method (or/c bytes? string? symbol?) #"GET"]
|
||||
[#:headers headers (listof (or/c bytes? string?)) empty]
|
||||
[#:data data (or/c false/c bytes? string?) #f]
|
||||
[#:data data (or/c false/c bytes? string? data-procedure/c) #f]
|
||||
[#:content-decode decodes (listof symbol?) '(gzip)])
|
||||
(values bytes? (listof bytes?) input-port?)]{
|
||||
|
||||
|
|
|
@ -240,4 +240,12 @@
|
|||
#"PUT / HTTP/1.1\r\nHost: localhost:REDACTED\r\nUser-Agent: Racket/REDACTED (net/http-client)\r\nAccept-Encoding: gzip\r\nContent-Length: 4\r\nConnection: close\r\n\r\nfrob"
|
||||
#"HTTP/1.1 200 OK"
|
||||
'()
|
||||
#""]
|
||||
|
||||
["PUT"
|
||||
(λ (w) (w "fr") (w "ob"))
|
||||
"HTTP/1.1 200 OK\r\n\r\n"
|
||||
#"PUT / HTTP/1.1\r\nHost: localhost:REDACTED\r\nUser-Agent: Racket/REDACTED (net/http-client)\r\nAccept-Encoding: gzip\r\nTransfer-Encoding: chunked\r\nConnection: close\r\n\r\n2\r\nfr\r\n2\r\nob\r\n\r\n"
|
||||
#"HTTP/1.1 200 OK"
|
||||
'()
|
||||
#""]))
|
||||
|
|
Loading…
Reference in New Issue
Block a user