mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
refactor: rename _requestId
to id
(#11850)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
This commit is contained in:
parent
27c71a9cf6
commit
6c5b9ad3b9
@ -94,7 +94,8 @@ export abstract class HTTPRequest {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_requestId = '';
|
||||
abstract get id(): string;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
@ -616,7 +616,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
||||
)
|
||||
).pipe(
|
||||
filter(request => {
|
||||
return request._requestId === originalRequest._requestId;
|
||||
return request.id === originalRequest.id;
|
||||
}),
|
||||
take(1),
|
||||
map(() => {
|
||||
|
@ -19,6 +19,7 @@ import type {BidiHTTPResponse} from './HTTPResponse.js';
|
||||
* @internal
|
||||
*/
|
||||
export class BidiHTTPRequest extends HTTPRequest {
|
||||
override id: string;
|
||||
override _response: BidiHTTPResponse | null = null;
|
||||
override _redirectChain: BidiHTTPRequest[];
|
||||
_navigationId: string | null;
|
||||
@ -46,7 +47,7 @@ export class BidiHTTPRequest extends HTTPRequest {
|
||||
this.#initiator = event.initiator;
|
||||
this.#frame = frame;
|
||||
|
||||
this._requestId = event.request.request;
|
||||
this.id = event.request.request;
|
||||
this._redirectChain = redirectChain;
|
||||
this._navigationId = event.navigation;
|
||||
|
||||
|
@ -28,6 +28,7 @@ import type {CdpHTTPResponse} from './HTTPResponse.js';
|
||||
* @internal
|
||||
*/
|
||||
export class CdpHTTPRequest extends HTTPRequest {
|
||||
override id: string;
|
||||
declare _redirectChain: CdpHTTPRequest[];
|
||||
declare _response: CdpHTTPResponse | null;
|
||||
|
||||
@ -91,7 +92,7 @@ export class CdpHTTPRequest extends HTTPRequest {
|
||||
) {
|
||||
super();
|
||||
this.#client = client;
|
||||
this._requestId = data.requestId;
|
||||
this.id = data.requestId;
|
||||
this.#isNavigationRequest =
|
||||
data.requestId === data.loaderId && data.type === 'Document';
|
||||
this._interceptionId = interceptionId;
|
||||
@ -188,7 +189,7 @@ export class CdpHTTPRequest extends HTTPRequest {
|
||||
override async fetchPostData(): Promise<string | undefined> {
|
||||
try {
|
||||
const result = await this.#client.send('Network.getRequestPostData', {
|
||||
requestId: this._requestId,
|
||||
requestId: this.id,
|
||||
});
|
||||
return result.postData;
|
||||
} catch (err) {
|
||||
|
@ -130,7 +130,7 @@ export class CdpHTTPResponse extends HTTPResponse {
|
||||
const response = await this.#client.send(
|
||||
'Network.getResponseBody',
|
||||
{
|
||||
requestId: this.#request._requestId,
|
||||
requestId: this.#request.id,
|
||||
}
|
||||
);
|
||||
return Buffer.from(
|
||||
|
@ -191,14 +191,14 @@ export class LifecycleWatcher {
|
||||
}
|
||||
|
||||
#onRequestFailed(request: HTTPRequest): void {
|
||||
if (this.#navigationRequest?._requestId !== request._requestId) {
|
||||
if (this.#navigationRequest?.id !== request.id) {
|
||||
return;
|
||||
}
|
||||
this.#navigationResponseReceived?.resolve();
|
||||
}
|
||||
|
||||
#onResponse(response: HTTPResponse): void {
|
||||
if (this.#navigationRequest?._requestId !== response.request()._requestId) {
|
||||
if (this.#navigationRequest?.id !== response.request().id) {
|
||||
return;
|
||||
}
|
||||
this.#navigationResponseReceived?.resolve();
|
||||
|
@ -637,7 +637,7 @@ export class NetworkManager extends EventEmitter<NetworkManagerEvents> {
|
||||
}
|
||||
|
||||
#forgetRequest(request: CdpHTTPRequest, events: boolean): void {
|
||||
const requestId = request._requestId;
|
||||
const requestId = request.id;
|
||||
const interceptionId = request._interceptionId;
|
||||
|
||||
this.#networkEventManager.forgetRequest(requestId);
|
||||
|
Loading…
Reference in New Issue
Block a user