1/** 2 * Copyright 2017 Google Inc. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16import { EventEmitter } from './EventEmitter.js'; 17import { Protocol } from 'devtools-protocol'; 18import { CDPSession } from './Connection.js'; 19import { FrameManager } from './FrameManager.js'; 20import { HTTPRequest } from './HTTPRequest.js'; 21/** 22 * @public 23 */ 24export interface Credentials { 25 username: string; 26 password: string; 27} 28/** 29 * We use symbols to prevent any external parties listening to these events. 30 * They are internal to Puppeteer. 31 * 32 * @internal 33 */ 34export declare const NetworkManagerEmittedEvents: { 35 readonly Request: symbol; 36 readonly Response: symbol; 37 readonly RequestFailed: symbol; 38 readonly RequestFinished: symbol; 39}; 40/** 41 * @internal 42 */ 43export declare class NetworkManager extends EventEmitter { 44 _client: CDPSession; 45 _ignoreHTTPSErrors: boolean; 46 _frameManager: FrameManager; 47 _requestIdToRequest: Map<string, HTTPRequest>; 48 _requestIdToRequestWillBeSentEvent: Map<string, Protocol.Network.RequestWillBeSentEvent>; 49 _extraHTTPHeaders: Record<string, string>; 50 _offline: boolean; 51 _credentials?: Credentials; 52 _attemptedAuthentications: Set<string>; 53 _userRequestInterceptionEnabled: boolean; 54 _protocolRequestInterceptionEnabled: boolean; 55 _userCacheDisabled: boolean; 56 _requestIdToInterceptionId: Map<string, string>; 57 constructor(client: CDPSession, ignoreHTTPSErrors: boolean, frameManager: FrameManager); 58 initialize(): Promise<void>; 59 authenticate(credentials?: Credentials): Promise<void>; 60 setExtraHTTPHeaders(extraHTTPHeaders: Record<string, string>): Promise<void>; 61 extraHTTPHeaders(): Record<string, string>; 62 setOfflineMode(value: boolean): Promise<void>; 63 setUserAgent(userAgent: string): Promise<void>; 64 setCacheEnabled(enabled: boolean): Promise<void>; 65 setRequestInterception(value: boolean): Promise<void>; 66 _updateProtocolRequestInterception(): Promise<void>; 67 _updateProtocolCacheDisabled(): Promise<void>; 68 _onRequestWillBeSent(event: Protocol.Network.RequestWillBeSentEvent): void; 69 _onAuthRequired(event: Protocol.Fetch.AuthRequiredEvent): void; 70 _onRequestPaused(event: Protocol.Fetch.RequestPausedEvent): void; 71 _onRequest(event: Protocol.Network.RequestWillBeSentEvent, interceptionId?: string): void; 72 _onRequestServedFromCache(event: Protocol.Network.RequestServedFromCacheEvent): void; 73 _handleRequestRedirect(request: HTTPRequest, responsePayload: Protocol.Network.Response): void; 74 _onResponseReceived(event: Protocol.Network.ResponseReceivedEvent): void; 75 _onLoadingFinished(event: Protocol.Network.LoadingFinishedEvent): void; 76 _onLoadingFailed(event: Protocol.Network.LoadingFailedEvent): void; 77} 78//# sourceMappingURL=NetworkManager.d.ts.map