Request Class
Represents an incoming client request.
Constructor
Request
-
props
Parameters:
-
props
Object-
url
StringRequest URL
-
method
StringRequest method ("GET", "POST", ...)
-
headers
ObjectRequest headers
-
upgrade
BufferWhether or not the request is an upgrade request
-
rawBody
BufferRequest body, if any
-
Item Index
Attributes
Attributes
body
Parsed request body for common content types (could be a
string or an object, depending on the content type). If the
content type is not supported or was unparseable, body
will
be null
. JSON bodies and form parameters will become objects,
and plain text and HTML will become strings.
params
Object
Request URL path captured parameters. Note that this attribute is only available in request objects passed directly by RoboHydra, not in user-created request objects.
When defining URL paths, expressions like :id
or :user
can
be used as part of the regular expression (eg. /save/:id
or
/:user/preferences
). These expressions will match any URL
path fragment, and the matched contents will be available in
the params
object in the request object. For example, if you
have a head for path /articles/:articleid/view
and you
receive a request for
/articles/introduction-to-robohydra/view
, the request object
will have a params
property with a single property,
articleid
with value introduction-to-robohydra
.