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

# `up.Request`

A normalized description of an [HTTP request](https://unpoly.com/api/up.request.md).

You can queue a request using the [`up.request()`](https://unpoly.com/api/up.request.md) method:

```js
let request = up.request('/foo')
console.log(request.url)

// A request object is also a promise for its response
let response = await request
console.log(response.text)
```

---

## Features {#features}

- ### [up.Request.prototype.abort([options])](https://unpoly.com/api/up.Request.prototype.abort.md) (Instance method)

  Aborts this request.

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

  Whether this request is loading in the background.

- ### [up.Request.prototype.badResponseTime](https://unpoly.com/api/up.Request.prototype.badResponseTime.md) (Property) (deprecated)

  The number of milliseconds after which this request can cause an `up:network:late` event and show the progress bar.

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

  The format in which the request params will be encoded.

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

  The context of the layer targeted by this request.

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

  Returns whether this request is no longer waiting for the network.

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

  The context of the layer targeted by this request in case the server responds with an error code.

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

  The layer targeted by this request in case the server responds with an error code.

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

  The mode of the layer targeted by this request in case the server responds with an error code.

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

  The CSS selector targeted by this request in case the server responds with an error code.

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

  Returns the fragment matched by this request's target selector.

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

  Returns the fragments matched by this request's target selector.

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

  The hash component of this request's URL.

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

  Returns the HTTP request header value with the given name.

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

  An object of HTTP headers that will be sent with this request.

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

  Returns whether this request uses a safe HTTP method like `GET`.

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

  The number of milliseconds after which this request can cause an `up:network:late` event and show the progress bar.

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

  The layer targeted by this request.

- ### [up.Request.prototype.loadPage()](https://unpoly.com/api/up.Request.prototype.loadPage.md) (Instance method)

  Loads this request object as a full-page request, replacing the entire browser environment with a new page from the server response.

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

  The HTTP method for the request.

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

  The mode of the layer targeted by this request.

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

  Loads this request object as a full-page request, replacing the entire browser environment with a new page from the server response.

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

  The element that triggered the request.

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

  The mode of the layer from which the interaction originated.

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

  Parameters that should be sent as the request's payload.

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

  The payload that the request will encode into its body.

- ### [up.Request.prototype.preload](https://unpoly.com/api/up.Request.prototype.preload.md) (Property) (deprecated)

  Whether this request is preloading content.

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

  The CSS selector targeted by this request.

- ### [up.Request.prototype.then(onFulfilled, onRejected)](https://unpoly.com/api/up.Request.prototype.then.md) (Instance method)

  An `up.Request` is also a promise for the server response.

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

  A timeout in milliseconds.

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

  The requested URL.

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

  Whether to wrap non-standard HTTP methods in a POST request.

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

  Returns the underlying `XMLHttpRequest` instance.

