Class request
Helpers for reading data from the HTTP request.
Defined in: <global\request.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
request()
Note: you can call print(request) to see a nice display for debugging.
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
request.clientAddr
Holds the IP address of the user making the request.
|
| <static> |
request.cookies
Contains a map of name:value of all the cookies sent with the
request.
|
| <static> |
request.headers
Used to access the HTTP headers of the current request.
|
| <static> |
request.isCron
Whether the current HTTP request is a CRON request.
|
| <static> |
request.isGet
Whether the curent HTTP request is a GET request.
|
| <static> |
request.isPost
Whether the current HTTP request is a POST request.
|
| <static> |
request.method
Either "GET" or "POST" (uppercase).
|
| <static> |
request.params
Parameters associated with the request, either from the query string
or from the contents of a POST, e.g.
|
| <static> |
request.path
The request path following the hostname.
|
| <static> |
request.query
The value request query string.
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
request.toHTML()
Enables pretty-printing of request object for debugging.
|
Field Detail
<static>
{string}
request.clientAddr
Holds the IP address of the user making the request.
<static>
{object}
request.cookies
Contains a map of name:value of all the cookies sent with the
request. All values are strings.
if (request.cookies['SessionID'] == "25") {
// process session number 25
}
<static>
{object}
request.headers
Used to access the HTTP headers of the current request. Properties are
header names, and each value is either a string (typically) or an
array of strings (if the header occurs multiple times in the request).
print(request.headers["User-Agent"]);
<static>
{boolean}
request.isCron
Whether the current HTTP request is a CRON request.
<static>
{boolean}
request.isGet
Whether the curent HTTP request is a GET request.
<static>
{boolean}
request.isPost
Whether the current HTTP request is a POST request.
<static>
{string}
request.method
Either "GET" or "POST" (uppercase).
<static>
{object}
request.params
Parameters associated with the request, either from the query string
or from the contents of a POST, e.g. from a form. Parameters are accessible
by name as properties of this object. The property value is either a
string (typically) or an array of strings (if the parameter occurs
multiple times in the request).
<static>
{string}
request.path
The request path following the hostname. For example, if the user
is visiting yourapp.appjet.net/foo, then this will be set to
"/foo".
This does not include CGI parameters or the domain name, and always
begins with a "/".
<static>
{string}
request.query
The value request query string.
For example, if the user visits "yourapp.appjet.net/foo?id=20", then
request.query will be "id=20".
Method Detail
<static>
{string}
request.toHTML()
Enables pretty-printing of request object for debugging.
- Returns:
- {string} html-formatted string.