puppeteer-core
Version:
A high-level API to control headless Chrome over the DevTools Protocol
118 lines (98 loc) • 3.03 kB
text/typescript
/**
* Copyright 2020 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
import type Protocol from 'devtools-protocol';
import type {Frame} from '../api/Frame.js';
import {
HTTPResponse as HTTPResponse,
type RemoteAddress,
} from '../api/HTTPResponse.js';
import {UnsupportedOperation} from '../common/Errors.js';
import type {BidiHTTPRequest} from './HTTPRequest.js';
/**
* @internal
*/
export class BidiHTTPResponse extends HTTPResponse {
constructor(
request: BidiHTTPRequest,
{response}: Bidi.Network.ResponseCompletedParameters
) {
super();
this.
this.
ip: '',
port: -1,
};
this.
this.
this.
this.
// TODO: File and issue with BiDi spec
this.
// TODO: Removed once the Firefox implementation is compliant with https://w3c.github.io/webdriver-bidi/#get-the-response-data.
for (const header of response.headers || []) {
// TODO: How to handle Binary Headers
// https://w3c.github.io/webdriver-bidi/#type-network-Header
if (header.value.type === 'string') {
this.
}
}
}
override remoteAddress(): RemoteAddress {
return this.
}
override url(): string {
return this.
}
override status(): number {
return this.
}
override statusText(): string {
return this.
}
override headers(): Record<string, string> {
return this.
}
override request(): BidiHTTPRequest {
return this.
}
override fromCache(): boolean {
return this.
}
override timing(): Protocol.Network.ResourceTiming | null {
return this.
}
override frame(): Frame | null {
return this.
}
override fromServiceWorker(): boolean {
return false;
}
override securityDetails(): never {
throw new UnsupportedOperation();
}
override buffer(): never {
throw new UnsupportedOperation();
}
}