Back to Puppeteer

HTTPRequest.abort() method

website/versioned_docs/version-24.40.0/api/puppeteer.httprequest.abort.md

19.2.2886 B
Original Source

HTTPRequest.abort() method

Aborts a request.

Signature

typescript
class HTTPRequest {
  abort(errorCode?: ErrorCode, priority?: number): Promise<void>;
}

Parameters

<table><thead><tr><th>

Parameter

</th><th>

Type

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

errorCode

</td><td>

ErrorCode

</td><td>

(Optional) optional error code to provide.

</td></tr> <tr><td>

priority

</td><td>

number

</td><td>

(Optional) If provided, intercept is resolved using cooperative handling rules. Otherwise, intercept is resolved immediately.

</td></tr> </tbody></table>

Returns:

Promise<void>

Remarks

To use this, request interception should be enabled with Page.setRequestInterception(). If it is not enabled, this method will throw an exception immediately.