123 lines
1.8 KiB
Plaintext
123 lines
1.8 KiB
Plaintext
|
|
p.location-badge.
|
|
exported from <a href='../http'>angular2/http</a>
|
|
defined in <a href="https://github.com/angular/angular/tree/3a0410a/modules/angular2/src/http/static_request.ts#L5-L54">angular2/src/http/static_request.ts (line 5)</a>
|
|
|
|
:markdown
|
|
Creates `Request` instances with default values.
|
|
|
|
The Request's interface is inspired by the Request constructor defined in the [Fetch
|
|
Spec](https://fetch.spec.whatwg.org/#request-class),
|
|
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.
|
|
|
|
|
|
.l-main-section
|
|
h2 Members
|
|
.l-sub-section
|
|
h3 constructor
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
constructor(url: string, {body, method = RequestMethods.GET, mode = RequestModesOpts.Cors,
|
|
credentials = RequestCredentialsOpts.Omit,
|
|
headers = new Headers()}?: IRequestOptions)
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 method
|
|
|
|
|
|
:markdown
|
|
|
|
Http method with which to perform the request.
|
|
|
|
Defaults to GET.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 mode
|
|
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 credentials
|
|
|
|
|
|
:markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 headers
|
|
|
|
|
|
:markdown
|
|
|
|
Headers object based on the `Headers` class in the [Fetch
|
|
Spec](https://fetch.spec.whatwg.org/#headers-class). <a href='Headers-class.html'><code>Headers</code></a> class reference.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 url
|
|
|
|
|
|
:markdown
|
|
|
|
Url of the remote resource
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.l-sub-section
|
|
h3 text
|
|
|
|
|
|
pre.prettyprint
|
|
code.
|
|
text()
|
|
|
|
:markdown
|
|
|
|
Returns the request's body as string, assuming that body exists. If body is undefined, return
|
|
empty
|
|
string.
|
|
|
|
|
|
|
|
|
|
|
|
|