Skip to main content
Version: 23.2.0

HTTPRequest.abort() 方法

¥HTTPRequest.abort() method

中止请求。

¥Aborts a request.

签名

¥Signature

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

参数

¥Parameters

范围

类型

描述

errorCode

ErrorCode

(可选)提供可选的错误代码。

priority

数字

(可选的)如果提供,则使用协作处理规则来解决拦截。否则,拦截将立即解决。

Returns:

Promise<void>

备注

¥Remarks

要使用此功能,应使用 Page.setRequestInterception() 启用请求拦截。如果未启用,该方法将立即抛出异常。

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