up.Request
JavaScript class
A normalized description of an HTTP request.
You can queue a request using the up.request() method:
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
-
Aborts this request.
-
Whether this request is loading in the background.
-
The number of milliseconds after which this request can cause an
up:network:lateevent and show the progress bar. -
The format in which the request params will be encoded.
-
The context of the layer targeted by this request.
-
Returns whether this request is no longer waiting for the network.
-
The context of the layer targeted by this request in case the server responds with an error code.
-
The layer targeted by this request in case the server responds with an error code.
-
The mode of the layer targeted by this request in case the server responds with an error code.
-
The CSS selector targeted by this request in case the server responds with an error code.
-
Returns the fragment matched by this request's target selector.
-
Returns the fragments matched by this request's target selector.
-
The hash component of this request's URL.
-
Returns the HTTP request header value with the given name.
-
An object of HTTP headers that will be sent with this request.
-
Returns whether this request uses a safe HTTP method like
GET. -
The number of milliseconds after which this request can cause an
up:network:lateevent and show the progress bar. -
The layer targeted by this request.
-
Loads this request object as a full-page request, replacing the entire browser environment with a new page from the server response.
-
The HTTP method for the request.
-
The mode of the layer targeted by this request.
-
Loads this request object as a full-page request, replacing the entire browser environment with a new page from the server response.
-
The element that triggered the request.
-
The mode of the layer from which the interaction originated.
-
Parameters that should be sent as the request's payload.
-
The payload that the request will encode into its body.
-
Whether this request is preloading content.
-
The CSS selector targeted by this request.
-
An
up.Requestis also a promise for the server response. -
A timeout in milliseconds.
-
The requested URL.
-
Whether to wrap non-standard HTTP methods in a POST request.
-
Returns the underlying
XMLHttpRequestinstance.