Request
Wrapper for the ExpressJS request, exposing only the necessary minimum.
Kind: global class
- Request
- new Request()
- ._request :
Express.Request
- .init(request)
- .getPath() ⇒
string
- .getCookieHeader() ⇒
string
- .getFile() ⇒
Object.<string, \*>
- .getFiles() ⇒
Object.<string, \*>
- .getBody() ⇒
string
- .getHeader(header) ⇒
string
- .getIP() ⇒
string
- .getIPs() ⇒
Array.<string>
new Request()
Initializes the request.
request._request : Express.Request
The current ExpressJS request object, or null
if running at
the client side.
Kind: instance property of Request
request.init(request)
Initializes the request using the provided ExpressJS request object.
Kind: instance method of Request
Param | Type | Description |
---|---|---|
request | Express.Request |
The ExpressJS request object representing the current request. Use null at the client side. |
request.getPath() ⇒ string
Returns the path part of the URL to which the request was made.
Kind: instance method of Request
Returns: string
- The path to which the request was made.
request.getCookieHeader() ⇒ string
Returns the Cookie
HTTP header value.
Kind: instance method of Request
Returns: string
- The value of the Cookie
header.
request.getFile() ⇒ Object.<string, \*>
Returns uploaded file to server and meta information.
Kind: instance method of Request
request.getFiles() ⇒ Object.<string, \*>
Returns upaloaded files to server with their meta information.
Kind: instance method of Request
request.getBody() ⇒ string
Returns body of request.
Kind: instance method of Request
request.getHeader(header) ⇒ string
Returns the specified HTTP request header.
Kind: instance method of Request
Param | Type |
---|---|
header | string |
request.getIP() ⇒ string
Returns the remote IP address of the request.
Kind: instance method of Request
request.getIPs() ⇒ Array.<string>
Returns array of IP addresses specified in the “X-Forwarded-For” request header.
Kind: instance method of Request