From 75d6c59fc25cdcc02f19b626961d46a96bb33234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 28 Nov 2012 22:26:44 +0100 Subject: 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. --- doc/ref/web.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc') diff --git a/doc/ref/web.texi b/doc/ref/web.texi index a93072f96..3b53ccdd6 100644 --- a/doc/ref/web.texi +++ b/doc/ref/web.texi @@ -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. -- cgit v1.2.1