Edit this page

API class up.Response

A response to an HTTP request.

Example

up.request('/foo').then(function(response) {
  console.log(response.status) // 200
  console.log(response.text)   // "<html><body>..."
})

Features

All features

JS
up.Response.prototype.age experimental

The number of milliseconds since this response was received.

JS
up.Response.prototype.contentType experimental

The response's content-type.

JS
up.Response.prototype.context experimental

Changes to the current context as set by the server.

JS
up.Response.prototype.etag experimental

The response's ETag.

JS
up.Response.prototype.expired experimental

Returns whether this cached response has expired.

JS
up.Response.prototype.getHeader(name) deprecated

Returns the HTTP header value with the given name.

JS
up.Response.prototype.header(name) stable

Returns the HTTP header value with the given name.

JS
up.Response.prototype.isError() deprecated

Returns whether the response was not successful.

JS
up.Response.prototype.isSuccess() deprecated

Returns whether the server responded with a 2xx HTTP status.

JS
up.Response.prototype.json stable

The response body parsed as a JSON string.

JS
up.Response.prototype.lastModified experimental

The last modification time of the response's underlying content.

JS
up.Response.prototype.method stable

The HTTP method used for the request that produced this response.

JS
up.Response.prototype.ok stable

Returns whether the server responded with a 2xx HTTP status.

JS
up.Response.prototype.status stable

The response's HTTP status code as a number.

JS
up.Response.prototype.target stable

A render target pushed by the server.

JS
up.Response.prototype.text stable

The response body as a string.

JS
up.Response.prototype.title experimental

A document title pushed by the server.

JS
up.Response.prototype.url stable

The URL from which the response was loaded.

JS
up.Response.prototype.xhr experimental

The XMLHttpRequest object that was used to create this response.