Class Overview
class Request extends Body {
constructor
(requestOptions: RequestArgs)
method
: RequestMethod
headers
: Headers
url
: string
withCredentials
: boolean
responseType
: ResponseContentType
detectContentType
() : ContentType
detectContentTypeFromBody
() : ContentType
getBody
() : any
}
Class Description
Creates Request
instances from provided values.
The Request's interface is inspired by the Request constructor defined in the Fetch Spec, but is considered a static value whose body can be accessed many times. There are other differences in the implementation, but this is the most significant.
Request
instances are typically created by higher-level classes, like Http
and
Jsonp
, but it may occasionally be useful to explicitly create Request
instances.
One such example is when creating services that wrap higher-level services, like Http
,
where it may be useful to generate a Request
with arbitrary headers and search params.
Class Details
method : RequestMethod
Http method with which to perform the request.
headers : Headers
Headers
instance
url : string
Url of the remote resource
withCredentials : boolean
Enable use credentials
responseType : ResponseContentType
Buffer to store the response
detectContentType() : ContentType
Returns the content type enum based on header options.
detectContentTypeFromBody() : ContentType
Returns the content type of request's body based on its type.
getBody() : any
Returns the request's body according to its type. If body is undefined, return null.
exported from http/index, defined in http/src/static_request.ts