Edit this page

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

This feature is experimental. Please share your experiences so we know what to keep or change.

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.