[racket-dev] Documentation lacuna?

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Mon Jan 21 07:34:55 EST 2013

Sorry, an addendum...

On 2013 Jan 21, at 12:23, Norman Gray <norman at astro.gla.ac.uk> wrote:

> In the web server, the documentation for RESPONSE and, by implication, RESPONSE/FULL does not explain how to avoid including a message-body in the response, as is required for 1xx, 204, 304 statuses (and those alone).
> 
> By experiment, giving RESPONSE/FULL a 'body' argument of #"" produces the right effect, but:
> 
>  (a) it would be reassuring if this case was mentioned in the documentation;
> 
>  (b) this still produces a content-length:0 header.

The other thing (ahem...) is that without such an explanation, it's not clear what to put as the MIME type.

Since there's no content, it's tempting to conclude that the 'mime' argument is ignored.  If, however, one gives this argument as #"" (on the grounds that it doesn't matter what it is), this is faithfully send down the wire as a "Content-Type: " header, which is invalid.  Giving 'mime' as #f (which is allowed in the contract of RESPONSE but not otherwise documented) _does_ suppress the content-type header, even though the documentation for RESPONSE states that the server will automatically add a Content-Type header if one is not present.

That is, one can produce the correct behaviour here, even though the documentation seems to suggest that no-body responses will be problematic.

Best wishes,

Norman


-- 
Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK



Posted on the dev mailing list.