---
name: "up.Response"
area: "API"
kind: "class"
parent: "up.network module"
url: "https://unpoly.com/api/up.Response"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.network module](https://unpoly.com/api/up.network.md)</nav>

# `up.Response`

A response to an [HTTP request](https://unpoly.com/api/up.request.md).

## Example {#example}

```js
let response = await up.request('/foo')
console.log(response.status) // 200
console.log(response.text)   // "<html><body>..."
```

---

## Features {#features}

- ### [up.Response.prototype.age](https://unpoly.com/api/up.Response.prototype.age.md) (Property)

  The number of milliseconds since this response was received.

- ### [up.Response.prototype.contentType](https://unpoly.com/api/up.Response.prototype.contentType.md) (Property)

  The response's content-type.

- ### [up.Response.prototype.context](https://unpoly.com/api/up.Response.prototype.context.md) (Property) (experimental)

  Changes to the current context as set by the server.

- ### [up.Response.prototype.etag](https://unpoly.com/api/up.Response.prototype.etag.md) (Property)

  The response's ETag.

- ### [up.Response.prototype.expired](https://unpoly.com/api/up.Response.prototype.expired.md) (Property)

  Returns whether this cached response has expired.

- ### [up.Response.prototype.getHeader(name)](https://unpoly.com/api/up.Response.prototype.getHeader.md) (Instance method) (deprecated)

  Returns the HTTP header value with the given name.

- ### [up.Response.prototype.header(name)](https://unpoly.com/api/up.Response.prototype.header.md) (Instance method)

  Returns the HTTP header value with the given name.

- ### [up.Response.prototype.isError()](https://unpoly.com/api/up.Response.prototype.isError.md) (Instance method) (deprecated)

  Returns whether the response was not successful.

- ### [up.Response.prototype.isHTML()](https://unpoly.com/api/up.Response.prototype.isHTML.md) (Instance method) (experimental)

  Returns whether the response has a content-type for HTML or XHTML.

- ### [up.Response.prototype.isSuccess()](https://unpoly.com/api/up.Response.prototype.isSuccess.md) (Instance method) (deprecated)

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

- ### [up.Response.prototype.json](https://unpoly.com/api/up.Response.prototype.json.md) (Property)

  The response body parsed from JSON.

- ### [up.Response.prototype.lastModified](https://unpoly.com/api/up.Response.prototype.lastModified.md) (Property)

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

- ### [up.Response.prototype.method](https://unpoly.com/api/up.Response.prototype.method.md) (Property)

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

- ### [up.Response.prototype.ok](https://unpoly.com/api/up.Response.prototype.ok.md) (Property)

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

- ### [up.Response.prototype.status](https://unpoly.com/api/up.Response.prototype.status.md) (Property)

  The response's HTTP status code as a `number`.

- ### [up.Response.prototype.target](https://unpoly.com/api/up.Response.prototype.target.md) (Property)

  A render target pushed by the server.

- ### [up.Response.prototype.text](https://unpoly.com/api/up.Response.prototype.text.md) (Property)

  The response body as a `string`.

- ### [up.Response.prototype.title](https://unpoly.com/api/up.Response.prototype.title.md) (Property) (experimental)

  A document title pushed by the server.

- ### [up.Response.prototype.url](https://unpoly.com/api/up.Response.prototype.url.md) (Property)

  The URL from which the response was loaded.

- ### [up.Response.prototype.xhr](https://unpoly.com/api/up.Response.prototype.xhr.md) (Property) (experimental)

  The `XMLHttpRequest` object that was used to create this response.

