mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-19 18:20:22 +02:00
web: Add `response-body-port'.
* module/web/response.scm (make-delimited-input-port, response-body-port): New procedures. (read-response-body): Use `response-body-port'. * test-suite/tests/web-response.test ("example-1")["response-body-port"]: New test. ("example-2")["response-body-port"]: New test.
This commit is contained in:
parent
ee2d874119
commit
75d6c59fc2
3 changed files with 85 additions and 13 deletions
|
@ -1315,6 +1315,16 @@ Note also, though, that responses to @code{HEAD} requests must also not
|
|||
have a body.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} response-body-port r [#:decode?=#t] [#:keep-alive?=#t]
|
||||
Return an input port from which the body of @var{r} can be read. The encoding
|
||||
of the returned port is set according to @var{r}'s @code{content-type} header,
|
||||
when it's textual, except if @var{decode?} is @code{#f}. Return @code{#f}
|
||||
when no body is available.
|
||||
|
||||
When @var{keep-alive?} is @code{#f}, closing the returned port also closes
|
||||
@var{r}'s response port.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} read-response-body r
|
||||
Read the response body from @var{r}, as a bytevector. Returns @code{#f}
|
||||
if there was no response body.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue