-
-
Notifications
You must be signed in to change notification settings - Fork 0
request
Nathanaël Cherrier (CI) edited this page Aug 27, 2019
·
2 revisions
export class Request {
get pathname(): string | undefined
get querystring(): ParsedUrlQuery
get method(): HttpMethod
get headers(): HttpHeaders
get anchor(): string | undefined
get body(): Promise<any>
get isCORS(): boolean
constructor(private httpRequest: HttpRequest)
match(pattern: string): boolean
}
It's a wrapper for the Request
objects from NodeJS API. The router will pass a Request
to controllers' actions.
Create an instance of Request
.
constructor(private httpRequest: HttpRequest)
-
httpRequest
: the request to be wrapped
-
pathname
: Readonly attribute to get the pathname -
querystring
: Readonly attribute to get the querystring as aParsedUrlQuery
-
method
: Readonly attribute to check the HTTP methods (or verbs) -
headers
: Readonly attribute to access to all headers entries in HTTP Request -
anchor
: Readonly atribute to get the current anchor -
body
: Readonly attribute to get the data used as body for the request -
isCORS
: Readonly attribute to doade a anadvz
Tests the resquest URL vs pattern.
match(pattern: string): boolean
-
pattern
: a string pattern
A boolean. true
if patern
matches the URL, else false
.