Edit this page

up.Request up.Request.prototype.abort([options])
Class method

This feature is experimental. It may be changed or removed in a future version.

Aborts this request.

The request's promise will reject with an up.AbortError.

Example

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

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

request.abort()

Parameters

[options.reason] string optional

A message describing the reason for aborting this request.

If omitted, a generic reason like "Aborted request to GET /path" will be used.

The reason will be set as the up.AbortError's message.