Connect/Express-like response object implementation to use in a non-Connect/Express environment.

Acts as writable stream (wraps and delegates to a native response stream) for response body data and provides callbacks to signal request processing status. In particular, the write() methods are intercepted for generating implicit 200 OK response status code headers.

Implements Textstream.

Constructor

new Markupresponse()

Name Description
headers Maps header names to values (allowing at most one value for a given header) to include in responses.
headersSent Flag telling if anything has been written to `responseStream`.
rawstream Contains raw stream for reading the file supplied to sendFile().
statusCode Readonly HTTP status code set via status().
textstream Contains text stream wrapper for reading raw stream in sendFile().

Name Description
end Must be called by request processing after having written all headers and the complete body.
get_filename Required by texstream API and used by eg.
set Puts `str` as value for the `header` HTTP header to send.
status Implementation of express.

Member Details

end()

Must be called by request processing after having written all headers and the complete body.

get_filename(): String

Required by texstream API and used by eg. platformbaseentitymanager to check if output is to a file rather than stdout. Always returns "-".

Returns

String

"-"

headers

Maps header names to values (allowing at most one value for a given header) to include in responses.

headersSent

Flag telling if anything has been written to responseStream.

rawstream

Contains raw stream for reading the file supplied to sendFile().

set()

Puts str as value for the header HTTP header to send.

status()

Implementation of express.js-like status() function; used for deferring status header response data

Once a status has been established (either explicitly via status() or implicitly via write() etc.), this method has no effect.

statusCode

Readonly HTTP status code set via status().

textstream

Contains text stream wrapper for reading raw stream in sendFile().