p.location-badge.
exported from angular2/http
defined in angular2/src/http/static_response.ts (line 5)
:markdown
Creates `Response` instances from provided values.
Though this object isn't
usually instantiated by end-users, it is the primary object interacted with when it comes time to
add data to a view.
#Example
```
http.request('my-friends.txt').subscribe(response => this.friends = response.text());
```
The Response's interface is inspired by the Response constructor defined in the [Fetch
Spec](https://fetch.spec.whatwg.org/#response-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(responseOptions: ResponseOptions)
:markdown
.l-sub-section
h3 type
:markdown
One of "basic", "cors", "default", "error, or "opaque".
Defaults to "default".
.l-sub-section
h3 ok
:markdown
True if the response's status is within 200-299
.l-sub-section
h3 url
:markdown
URL of response.
Defaults to empty string.
.l-sub-section
h3 status
:markdown
Status code returned by server.
Defaults to 200.
.l-sub-section
h3 statusText
:markdown
Text representing the corresponding reason phrase to the `status`, as defined in [ietf rfc 2616
section 6.1.1](https://tools.ietf.org/html/rfc2616#section-6.1.1)
Defaults to "OK"
.l-sub-section
h3 bytesLoaded
:markdown
Non-standard property
Denotes how many of the response body's bytes have been loaded, for example if the response is
the result of a progress event.
.l-sub-section
h3 totalBytes
:markdown
Non-standard property
Denotes how many bytes are expected in the final response body.
.l-sub-section
h3 headers
:markdown
Headers object based on the `Headers` class in the [Fetch
Spec](https://fetch.spec.whatwg.org/#headers-class).
.l-sub-section
h3 blob
pre.prettyprint
code.
blob()
:markdown
Not yet implemented
.l-sub-section
h3 json
pre.prettyprint
code.
json()
:markdown
Attempts to return body as parsed `JSON` object, or raises an exception.
.l-sub-section
h3 text
pre.prettyprint
code.
text()
:markdown
Returns the body as a string, presuming `toString()` can be called on the response body.
.l-sub-section
h3 arrayBuffer
pre.prettyprint
code.
arrayBuffer()
:markdown
Not yet implemented