HttpResponse.render

Renders the response message. If a message body is provided, it is appended to the response message according to RFC 2616, section 4.3; that is, - If status is either below 200 or 204 or 304, neither a message body nor a "Content-Length" header field are appended. - Otherwise, if head is true, a "Content-Length" header field reflecting msg_body.length is appended but the message body itself is not. - Otherwise, if head is false, both a "Content-Length" header field reflecting msg_body.length and the message body itself are appended.

If a message body is not provided, the same is done as for a message body with a zero length.

  1. cstring render(cstring msg_body, bool head)
  2. cstring render(HttpResponseCode status, cstring msg_body, bool head)
    class HttpResponse
    render
    (,
    cstring msg_body = null
    ,
    bool head = false
    )

Parameters

status HttpResponseCode

status code; must be at least 100 and less than 1000

msg_body cstring

response message body

head bool

set to true if msg_body should actually not be appended to the response message (HEAD response)

Return Value

Type: cstring

response message (exposes an internal buffer)

Meta