Request {ambiorix} | R Documentation |
Request
Description
A request.
Value
A Request object.
Public fields
HEADERS
Headers from the request.
HTTP_ACCEPT
Content types to accept.
HTTP_ACCEPT_ENCODING
Encoding of the request.
HTTP_ACCEPT_LANGUAGE
Language of the request.
HTTP_CACHE_CONTROL
Directorives for the cache (case-insensitive).
HTTP_CONNECTION
Controls whether the network connection stays open after the current transaction finishes.
HTTP_COOKIE
Cookie data.
HTTP_HOST
Host making the request.
HTTP_SEC_FETCH_DEST
Indicates the request's destination. That is the initiator of the original fetch request, which is where (and how) the fetched data will be used.
HTTP_SEC_FETCH_MODE
Indicates mode of the request.
HTTP_SEC_FETCH_SITE
Indicates the relationship between a request initiator's origin and the origin of the requested resource.
HTTP_SEC_FETCH_USER
Only sent for requests initiated by user activation, and its value will always be
?1
.HTTP_UPGRADE_INSECURE_REQUESTS
Signals that server supports upgrade.
HTTP_USER_AGENT
User agent.
SERVER_NAME
Name of the server.
httpuv.version
Version of httpuv.
PATH_INFO
Path of the request.
QUERY_STRING
Query string of the request.
REMOTE_ADDR
Remote address.
REMOTE_PORT
Remote port.
REQUEST_METHOD
Method of the request, e.g.:
GET
.rook.errors
Errors from rook.
rook.input
Rook inputs.
rook.url_scheme
Rook url scheme.
rook.version
Rook version.
SCRIPT_NAME
The initial portion of the request URL's "path" that corresponds to the application object, so that the application knows its virtual "location". #' @field SERVER_NAME Server name.
SERVER_PORT
Server port
CONTENT_LENGTH
Size of the message body.
CONTENT_TYPE
Type of content of the request.
HTTP_REFERER
Contains an absolute or partial address of the page that makes the request.
body
Request, an environment.
query
Parsed
QUERY_STRING
,list
.params
A
list
of parameters.cookie
Parsed
HTTP_COOKIE
.
Methods
Public methods
Method new()
Usage
Request$new(req)
Arguments
req
Original request (environment).
Details
Constructor
Method print()
Usage
Request$print()
Details
Method get_header()
Usage
Request$get_header(name)
Arguments
name
Name of the header
Details
Get Header
Method parse_multipart()
Usage
Request$parse_multipart()
Details
Parse Multipart encoded data
Method parse_json()
Usage
Request$parse_json(...)
Arguments
...
Arguments passed to
parse_json()
.
Details
Parse JSON encoded data
Method clone()
The objects of this class are cloneable with this method.
Usage
Request$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
if (interactive()) {
library(ambiorix)
app <- Ambiorix$new()
app$get("/", function(req, res) {
print(req)
res$send("Using {ambiorix}!")
})
app$start()
}