Spec

The Environment

requestMethod: The HTTP request method, e.g. GET, POST.

scriptName: The initial portion of the request URL‘s “path” that corresponds to the application object, so that the application knows its virtual “location”. This may be an empty string, if the application corresponds to the “root” of the server.

pathInfo: The remainder of the request URL‘s “path”, designating the virtual “location” of the request‘s target within the application. This may be an empty string, if the request URL targets the application root and does not have a trailing slash. This value may be percent-encoded when I originating from a URL.

queryString: The portion of the request URL that follows the ?, if any. May be empty, but is always required!

serverName, serverPort: When combined with scriptName and pathInfo, these variables can be used to complete the URL. Note, however, that Host in http field, if present, should be used in preference to serverName for reconstructing the request URL. serverName and serverPort can never be empty, and so are always required.

remoteHost: The remote host of this request

http: Variables corresponding to the client-supplied HTTP request headers (e.g. "Accept"). The presence or absence of these variables should correspond with the presence or absence of the appropriate HTTP header in the request.

hackVersion: The list of Int, representing this version of Hack

hackUrlScheme: HTTP or HTTPS, depending on the request URL.

hackInput: The body of the request.

hackErrors: The error stream.

hackHeaders: None http headers, intended to be used by handlers and middleware.

hackCache: High performance cache, could be used by handlers and middleware.

The Response

status: This is an HTTP status. It must be greater than or equal to 100.

headers: The header must not contain a Status key, contain keys with : or newlines in their name, contain keys names that end in - or , but only contain keys that consist of letters, digits, or - and start with a letter. The values of the header must be Strings, consisting of lines (for multiple header values) separated by “\n”. The lines must not contain characters below 037.

body: The body of the response.

Properties

The scriptName, if non-empty, must start with /

The pathInfo, if non-empty, must start with /

One of scriptName or pathInfo must be set. pathInfo should be / if scriptName is empty. scriptName never should be /, but instead be empty.