document and test #:method argument to http-client-recv!
This commit is contained in:
parent
b579bda4b3
commit
81b8f8961b
|
@ -78,9 +78,11 @@ Closes the output side of @racket[hc], if it is live.
|
||||||
void?]{
|
void?]{
|
||||||
|
|
||||||
Sends an HTTP request to @racket[hc] to the URI @racket[uri] using
|
Sends an HTTP request to @racket[hc] to the URI @racket[uri] using
|
||||||
HTTP version @racket[version] the method @racket[method] and the
|
HTTP version @racket[version], the method @racket[method], and the
|
||||||
additional headers given in @racket[headers] and the additional data
|
additional headers given in @racket[headers] and the additional data
|
||||||
@racket[data].
|
@racket[data]. If @racket[method] is @racket[#"HEAD"] (or
|
||||||
|
@racket["HEAD"] or @racket['HEAD]), provide the same @racket[method]
|
||||||
|
when calling @racket[http-conn-recv!] to avoid attempting to receive content.
|
||||||
|
|
||||||
If @racket[data] is a procedure, it will be called once with a
|
If @racket[data] is a procedure, it will be called once with a
|
||||||
procedure of one argument, which is a string or
|
procedure of one argument, which is a string or
|
||||||
|
@ -102,11 +104,13 @@ This function does not support requests that expect
|
||||||
|
|
||||||
@defproc[(http-conn-recv! [hc http-conn-live?]
|
@defproc[(http-conn-recv! [hc http-conn-live?]
|
||||||
[#:content-decode decodes (listof symbol?) '(gzip)]
|
[#:content-decode decodes (listof symbol?) '(gzip)]
|
||||||
|
[#:method method (or/c bytes? string? symbol?) #"GET"]
|
||||||
[#:close? close? boolean? #f])
|
[#:close? close? boolean? #f])
|
||||||
(values bytes? (listof bytes?) input-port?)]{
|
(values bytes? (listof bytes?) input-port?)]{
|
||||||
|
|
||||||
Parses an HTTP response from @racket[hc], while decoding the encodings
|
Parses an HTTP response from @racket[hc] for the method
|
||||||
listed in @racket[decodes].
|
@racket[method] while decoding the encodings listed in
|
||||||
|
@racket[decodes].
|
||||||
|
|
||||||
Returns the status line, a list of headers, and an port which contains
|
Returns the status line, a list of headers, and an port which contains
|
||||||
the contents of the response.
|
the contents of the response.
|
||||||
|
@ -116,7 +120,8 @@ following the response parsing. If @racket[close?] is @racket[#f],
|
||||||
then the connection is only closed if the server instructs the client
|
then the connection is only closed if the server instructs the client
|
||||||
to do so.
|
to do so.
|
||||||
|
|
||||||
}
|
@history[#:changed "6.1.1.6" @elem{Added the @racket[#:method] argument.}]}
|
||||||
|
|
||||||
|
|
||||||
@defproc[(http-conn-sendrecv! [hc http-conn-live?] [uri (or/c bytes? string?)]
|
@defproc[(http-conn-sendrecv! [hc http-conn-live?] [uri (or/c bytes? string?)]
|
||||||
[#:version version (or/c bytes? string?) #"1.1"]
|
[#:version version (or/c bytes? string?) #"1.1"]
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
#:data body)
|
#:data body)
|
||||||
(begin0
|
(begin0
|
||||||
(hc:http-conn-recv! c
|
(hc:http-conn-recv! c
|
||||||
|
#:method method
|
||||||
#:close? #t)
|
#:close? #t)
|
||||||
(check-equal? #f (hc:http-conn-live? c))))
|
(check-equal? #f (hc:http-conn-live? c))))
|
||||||
raw ereq estatus eheaders econtent))
|
raw ereq estatus eheaders econtent))
|
||||||
|
@ -256,4 +257,10 @@
|
||||||
#"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\n0\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\n0\r\n\r\n"
|
||||||
#"HTTP/1.1 200 OK"
|
#"HTTP/1.1 200 OK"
|
||||||
'()
|
'()
|
||||||
|
#""]
|
||||||
|
|
||||||
|
["HEAD" #f "HTTP/1.1 200 OK\r\n\r\n"
|
||||||
|
#"HEAD / HTTP/1.1\r\nHost: localhost:REDACTED\r\nUser-Agent: Racket/REDACTED (net/http-client)\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n"
|
||||||
|
#"HTTP/1.1 200 OK"
|
||||||
|
'()
|
||||||
#""]))
|
#""]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user