Class Request
- Defined in: Request.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Request(method, reqUrl, headers, bodyStream, protocol, pskId, psk)
Creates a new request from the given params.
|
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
|
Returns the base URL of this request: protocol://hostname:port
|
|
|
Returns a promise for an object obtained by JSON parsing the request body.
|
|
|
Gets the body stream.
|
|
|
getCookie(name)
Returns the value of the named cookie, or null if not found.
|
|
|
Returns the time elapsed since this request was created, in ms.
|
|
|
getHeader(name)
Returns the value of the header with the given name.
|
|
|
Returns the request headers.
|
|
|
Returns the parsed query string params.
|
|
|
getPskId()
Returns the PSK ID associated with the request's connection, if available.
|
|
|
getRelativeUrl(path)
Returns a URL formed by resolving the given path in the context of this request.
|
|
|
isDelete()
Returns true if this request is a GET request.
|
|
|
isGet()
Returns true if this request is a GET request.
|
|
|
isHead()
Returns true if this request is a GET request.
|
|
|
isPost()
Returns true if this request is a GET request.
|
|
|
isPut()
Returns true if this request is a GET request.
|
|
|
isSecure()
Returns true if this request was sent over TLS.
|
Class Detail
Request(method, reqUrl, headers, bodyStream, protocol, pskId, psk)
Creates a new request from the given params.
- Parameters:
- method
- reqUrl
- the URL after the host part
- headers
- bodyStream
- protocol
- pskId
- the TLS-PSK identity for this request
- psk
- the pre-shared key to authenticate the request
Method Detail
-
getBaseUrl()Returns the base URL of this request: protocol://hostname:port
- Returns:
- string
-
getBodyObject()Returns a promise for an object obtained by JSON parsing the request body. Note: this function necessarily buffers the entire request body.
- Returns:
- promise
-
getBodyStream()Gets the body stream.
-
getCookie(name)Returns the value of the named cookie, or null if not found.
- Parameters:
- name
-
getElapsedTime()Returns the time elapsed since this request was created, in ms.
-
getHeader(name)Returns the value of the header with the given name.
- Parameters:
- name
-
getHeaders()Returns the request headers.
-
getParams()Returns the parsed query string params.
- Returns:
- object
-
getPskId()Returns the PSK ID associated with the request's connection, if available.
-
getRelativeUrl(path)Returns a URL formed by resolving the given path in the context of this request.
- Parameters:
- path
- Returns:
- string
-
isDelete()Returns true if this request is a GET request.
-
isGet()Returns true if this request is a GET request.
-
isHead()Returns true if this request is a GET request.
-
isPost()Returns true if this request is a GET request.
-
isPut()Returns true if this request is a GET request.
-
isSecure()Returns true if this request was sent over TLS.