export class Response
export class Response
exported from angular2/http defined in angular2/src/http/static_response.ts (line 6)
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
The Response's interface is inspired by the Response 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.
Constructor
constructor(responseOptions: ResponseOptions)
constructor(responseOptions: ResponseOptions)
Not Yet Documented
Members
type : ResponseType
type : ResponseType
One of "basic", "cors", "default", "error, or "opaque".
Defaults to "default".
ok : boolean
ok : boolean
True if the response's status is within 200-299
url : string
url : string
URL of response.
Defaults to empty string.
status : number
status : number
Status code returned by server.
Defaults to 200.
statusText : string
statusText : string
Text representing the corresponding reason phrase to the status
, as defined in ietf rfc 2616
section 6.1.1
Defaults to "OK"
bytesLoaded : number
bytesLoaded : number
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.
totalBytes : number
totalBytes : number
Non-standard property
Denotes how many bytes are expected in the final response body.
headers : Headers
headers : Headers
Headers object based on the Headers
class in the Fetch
Spec.
blob() : any
blob() : any
Not yet implemented
json() : any
json() : any
Attempts to return body as parsed JSON
object, or raises an exception.
text() : string
text() : string
Returns the body as a string, presuming toString()
can be called on the response body.
arrayBuffer() : any
arrayBuffer() : any
Not yet implemented