Provides access for writing the headers and content of an HttpClientRequest or an HttpServerResponse.

By: Julien Viet
Initializer
HttpOutput()
Attributes
chunkedshared formal Boolean chunked
streamshared formal WriteStream stream

The write stream of this request

Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
contentTypeshared default O contentType(String mimeType, String charset = ...)

Set the content type of the response.

Parameters:
  • charset = "UTF-8"
endshared formal O end(Chunk? chunk = null)

Ends the response. If no data has been written to the response body, the actual response won't get written until this method gets called. Once the response has ended, it cannot be used any more.

Parameters:
  • chunk = null

    The optional data chunk to write as the response content:

    • when the argument is a String the UTF-8 encoding is used
    • when the argument is a [String,String], the first value is the chunk and the second is the encoding
headersshared formal O headers({<String->String|{String+}>*} headers)

Set the response headers.

writeshared formal O write(Chunk chunk)

Write a chunk to the output body.

Parameters:
  • chunk

    The data chunk to write:

    • when the argument is a String the UTF-8 encoding is used
    • when the argument is a [String,String], the first value is the chunk and the second is the encoding
Inherited Methods
Methods inherited from: Object
equals