Edit this page

up.network up.network.abort([matcher])
JavaScript function

Aborts pending requests.

The event up:request:aborted will be emitted.

The promise returned by up.request() will be rejected with an exception named AbortError:

try {
  let response = await up.request('/path')
} catch (err) {
  if (err.name == 'AbortError') {
    console.log('Request was aborted')


Without arguments, this will abort all pending requests:


To abort a given up.Request object, pass it as the first argument:

let request = up.request('/path')

To abort all requests matching a condition, pass a function that takes a request and returns a boolean value. Unpoly will abort all request for which the given function returns true. E.g. to abort all requests with a HTTP method as GET:

up.network.abort((request) => request.method == 'GET')


[matcher=true] up.RequestorbooleanorFunction(up.Request): boolean optional

If this argument is omitted, all pending requests are aborted.

This website uses cookies to improve usability and analyze traffic.
I accept or learn more