rebrowser-playwright-core 1.49.0 → 1.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ThirdPartyNotices.txt +381 -55
- package/bin/reinstall_msedge_beta_linux.sh +6 -0
- package/bin/reinstall_msedge_dev_linux.sh +6 -0
- package/bin/reinstall_msedge_stable_linux.sh +6 -0
- package/browsers.json +28 -13
- package/index.js +0 -1
- package/lib/androidServerImpl.js +42 -48
- package/lib/browserServerImpl.js +60 -64
- package/lib/cli/driver.js +71 -69
- package/lib/cli/program.js +314 -354
- package/lib/cli/programWithTestStub.js +51 -44
- package/lib/client/accessibility.js +31 -32
- package/lib/client/android.js +146 -254
- package/lib/client/api.js +135 -283
- package/lib/client/artifact.js +39 -39
- package/lib/client/browser.js +59 -68
- package/lib/client/browserContext.js +302 -322
- package/lib/client/browserType.js +95 -143
- package/lib/client/cdpSession.js +29 -31
- package/lib/client/channelOwner.js +109 -139
- package/lib/client/clientHelper.js +49 -42
- package/lib/client/clientInstrumentation.js +40 -35
- package/lib/client/clientStackTrace.js +69 -0
- package/lib/client/clock.js +36 -36
- package/lib/client/connection.js +203 -218
- package/lib/client/consoleMessage.js +33 -33
- package/lib/client/coverage.js +25 -22
- package/lib/client/dialog.js +30 -31
- package/lib/client/download.js +25 -25
- package/lib/client/electron.js +74 -76
- package/lib/client/elementHandle.js +126 -163
- package/lib/client/errors.js +53 -53
- package/lib/client/eventEmitter.js +127 -127
- package/lib/client/events.js +72 -68
- package/lib/client/fetch.js +154 -178
- package/lib/client/fileChooser.js +25 -24
- package/lib/client/fileUtils.js +34 -0
- package/lib/client/frame.js +189 -307
- package/lib/client/harRouter.js +44 -56
- package/lib/client/input.js +40 -69
- package/lib/client/jsHandle.js +55 -71
- package/lib/client/jsonPipe.js +27 -23
- package/lib/client/localUtils.js +53 -28
- package/lib/client/locator.js +144 -230
- package/lib/client/network.js +285 -301
- package/lib/client/page.js +273 -312
- package/lib/client/platform.js +74 -0
- package/lib/client/playwright.js +62 -57
- package/lib/client/selectors.js +51 -43
- package/lib/client/stream.js +30 -45
- package/lib/client/timeoutSettings.js +75 -0
- package/lib/client/tracing.js +49 -82
- package/lib/client/types.js +26 -22
- package/lib/client/video.js +35 -27
- package/lib/client/waiter.js +71 -91
- package/lib/client/webError.js +25 -23
- package/lib/client/webSocket.js +111 -0
- package/lib/client/worker.js +48 -56
- package/lib/client/writableStream.js +28 -43
- package/lib/generated/clockSource.js +26 -5
- package/lib/generated/consoleApiSource.js +26 -5
- package/lib/generated/injectedScriptSource.js +26 -5
- package/lib/generated/pollingRecorderSource.js +26 -5
- package/lib/generated/utilityScriptSource.js +26 -5
- package/lib/generated/webSocketMockSource.js +375 -4
- package/lib/inProcessFactory.js +53 -48
- package/lib/inprocess.js +2 -19
- package/lib/outofprocess.js +53 -42
- package/lib/protocol/debug.js +209 -25
- package/lib/protocol/serializers.js +153 -134
- package/lib/protocol/validator.js +2712 -2667
- package/lib/protocol/validatorPrimitives.js +115 -75
- package/lib/remote/playwrightConnection.js +144 -152
- package/lib/remote/playwrightServer.js +106 -77
- package/lib/server/accessibility.js +44 -37
- package/lib/server/android/android.js +216 -206
- package/lib/server/android/backendAdb.js +89 -82
- package/lib/server/artifact.js +78 -55
- package/lib/server/bidi/bidiBrowser.js +227 -158
- package/lib/server/bidi/bidiChromium.js +106 -78
- package/lib/server/bidi/bidiConnection.js +66 -83
- package/lib/server/bidi/bidiExecutionContext.js +161 -97
- package/lib/server/bidi/bidiFirefox.js +76 -68
- package/lib/server/bidi/bidiInput.js +90 -102
- package/lib/server/bidi/bidiNetworkManager.js +141 -159
- package/lib/server/bidi/bidiOverCdp.js +57 -58
- package/lib/server/bidi/bidiPage.js +262 -261
- package/lib/server/bidi/bidiPdf.js +52 -86
- package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/lib/server/bidi/third_party/bidiDeserializer.js +55 -50
- package/lib/server/bidi/third_party/bidiKeyboard.js +241 -223
- package/lib/server/bidi/third_party/bidiProtocol.js +144 -131
- package/lib/server/bidi/third_party/bidiSerializer.js +67 -63
- package/lib/server/bidi/third_party/firefoxPrefs.js +149 -111
- package/lib/server/browser.js +76 -84
- package/lib/server/browserContext.js +343 -360
- package/lib/server/browserType.js +169 -181
- package/lib/server/callLog.js +82 -0
- package/lib/server/chromium/chromium.js +212 -190
- package/lib/server/chromium/chromiumSwitches.js +99 -44
- package/lib/server/chromium/crAccessibility.js +157 -131
- package/lib/server/chromium/crBrowser.js +262 -280
- package/lib/server/chromium/crConnection.js +121 -178
- package/lib/server/chromium/crCoverage.js +113 -127
- package/lib/server/chromium/crDevTools.js +64 -55
- package/lib/server/chromium/crDragDrop.js +62 -79
- package/lib/server/chromium/crExecutionContext.js +100 -91
- package/lib/server/chromium/crInput.js +101 -88
- package/lib/server/chromium/crNetworkManager.js +269 -370
- package/lib/server/chromium/crPage.js +509 -595
- package/lib/server/chromium/crPdf.js +54 -86
- package/lib/server/chromium/crProtocolHelper.js +92 -80
- package/lib/server/chromium/crServiceWorker.js +85 -69
- package/lib/server/chromium/defaultFontFamilies.js +152 -135
- package/lib/server/chromium/protocol.d.js +16 -0
- package/lib/server/chromium/videoRecorder.js +65 -99
- package/lib/server/clock.js +58 -46
- package/lib/server/codegen/csharp.js +191 -156
- package/lib/server/codegen/java.js +163 -125
- package/lib/server/codegen/javascript.js +166 -143
- package/lib/server/codegen/jsonl.js +33 -29
- package/lib/server/codegen/language.js +75 -52
- package/lib/server/codegen/languages.js +65 -27
- package/lib/server/codegen/python.js +141 -125
- package/lib/server/codegen/types.js +15 -4
- package/lib/server/console.js +28 -32
- package/lib/server/cookieStore.js +105 -86
- package/lib/server/debugController.js +102 -154
- package/lib/server/debugger.js +82 -78
- package/lib/server/deviceDescriptors.js +37 -24
- package/lib/server/deviceDescriptorsSource.json +131 -131
- package/lib/server/dialog.js +36 -35
- package/lib/server/dispatchers/androidDispatcher.js +196 -107
- package/lib/server/dispatchers/artifactDispatcher.js +62 -62
- package/lib/server/dispatchers/browserContextDispatcher.js +177 -217
- package/lib/server/dispatchers/browserDispatcher.js +78 -97
- package/lib/server/dispatchers/browserTypeDispatcher.js +35 -35
- package/lib/server/dispatchers/cdpSessionDispatcher.js +32 -36
- package/lib/server/dispatchers/debugControllerDispatcher.js +48 -64
- package/lib/server/dispatchers/dialogDispatcher.js +30 -27
- package/lib/server/dispatchers/dispatcher.js +180 -229
- package/lib/server/dispatchers/electronDispatcher.js +54 -57
- package/lib/server/dispatchers/elementHandlerDispatcher.js +79 -116
- package/lib/server/dispatchers/frameDispatcher.js +93 -162
- package/lib/server/dispatchers/jsHandleDispatcher.js +49 -66
- package/lib/server/dispatchers/jsonPipeDispatcher.js +35 -36
- package/lib/server/dispatchers/localUtilsDispatcher.js +107 -365
- package/lib/server/dispatchers/networkDispatchers.js +92 -109
- package/lib/server/dispatchers/pageDispatcher.js +130 -169
- package/lib/server/dispatchers/playwrightDispatcher.js +69 -76
- package/lib/server/dispatchers/selectorsDispatcher.js +28 -24
- package/lib/server/dispatchers/streamDispatcher.js +42 -44
- package/lib/server/dispatchers/tracingDispatcher.js +36 -41
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +100 -135
- package/lib/server/dispatchers/writableStreamDispatcher.js +54 -39
- package/lib/server/dom.js +424 -443
- package/lib/server/download.js +45 -35
- package/lib/server/electron/electron.js +156 -175
- package/lib/server/electron/loader.js +8 -36
- package/lib/server/errors.js +47 -46
- package/lib/server/fetch.js +302 -331
- package/lib/server/fileChooser.js +25 -24
- package/lib/server/fileUploadUtils.js +66 -57
- package/lib/server/firefox/ffAccessibility.js +153 -131
- package/lib/server/firefox/ffBrowser.js +218 -274
- package/lib/server/firefox/ffConnection.js +63 -84
- package/lib/server/firefox/ffExecutionContext.js +103 -77
- package/lib/server/firefox/ffInput.js +72 -63
- package/lib/server/firefox/ffNetworkManager.js +131 -110
- package/lib/server/firefox/ffPage.js +244 -302
- package/lib/server/firefox/firefox.js +76 -69
- package/lib/server/firefox/protocol.d.js +16 -0
- package/lib/server/formData.js +107 -35
- package/lib/server/frameSelectors.js +77 -111
- package/lib/server/frames.js +719 -855
- package/lib/server/har/harRecorder.js +85 -77
- package/lib/server/har/harTracer.js +288 -224
- package/lib/server/harBackend.js +157 -0
- package/lib/server/helper.js +56 -59
- package/lib/server/index.js +59 -106
- package/lib/server/input.js +136 -166
- package/lib/server/instrumentation.js +49 -44
- package/lib/server/javascript.js +157 -151
- package/lib/server/launchApp.js +92 -73
- package/lib/server/localUtils.js +211 -0
- package/lib/server/macEditingCommands.js +141 -137
- package/lib/server/network.js +263 -297
- package/lib/server/page.js +353 -432
- package/lib/server/pageBinding.js +88 -0
- package/lib/server/pipeTransport.js +49 -45
- package/lib/server/playwright.js +60 -67
- package/lib/server/progress.js +56 -51
- package/lib/server/protocolError.js +34 -31
- package/lib/server/recorder/chat.js +161 -0
- package/lib/server/recorder/contextRecorder.js +135 -148
- package/lib/server/recorder/recorderApp.js +129 -132
- package/lib/server/recorder/recorderCollection.js +57 -57
- package/lib/server/recorder/recorderFrontend.js +15 -4
- package/lib/server/recorder/recorderRunner.js +80 -100
- package/lib/server/recorder/recorderUtils.js +59 -72
- package/lib/server/recorder/throttledFile.js +42 -31
- package/lib/server/recorder.js +186 -190
- package/lib/server/registry/browserFetcher.js +107 -100
- package/lib/server/registry/dependencies.js +247 -198
- package/lib/server/registry/index.js +928 -709
- package/lib/server/registry/nativeDeps.js +1073 -461
- package/lib/server/registry/oopDownloadBrowserMain.js +57 -75
- package/lib/server/screenshotter.js +166 -182
- package/lib/server/selectors.js +85 -46
- package/lib/server/socksClientCertificatesInterceptor.js +166 -185
- package/lib/server/socksInterceptor.js +62 -67
- package/lib/server/storageScript.js +154 -0
- package/lib/server/timeoutSettings.js +89 -0
- package/lib/server/trace/recorder/snapshotter.js +70 -88
- package/lib/server/trace/recorder/snapshotterInjected.js +246 -218
- package/lib/server/trace/recorder/tracing.js +324 -327
- package/lib/server/trace/test/inMemorySnapshotter.js +46 -52
- package/lib/server/trace/viewer/traceViewer.js +172 -137
- package/lib/server/transport.js +125 -133
- package/lib/server/types.js +26 -22
- package/lib/server/usKeyboardLayout.js +135 -545
- package/lib/server/utils/ascii.js +44 -0
- package/lib/server/utils/comparators.js +161 -0
- package/lib/server/utils/crypto.js +216 -0
- package/lib/server/utils/debug.js +47 -0
- package/lib/server/utils/debugLogger.js +114 -0
- package/lib/server/utils/env.js +68 -0
- package/lib/server/utils/eventsHelper.js +39 -0
- package/lib/server/utils/expectUtils.js +38 -0
- package/lib/server/utils/fileUtils.js +191 -0
- package/lib/server/utils/happyEyeballs.js +207 -0
- package/lib/server/utils/hostPlatform.js +109 -0
- package/lib/server/utils/httpServer.js +218 -0
- package/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/lib/{image_tools → server/utils/image_tools}/compare.js +44 -43
- package/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/lib/{image_tools → server/utils/image_tools}/stats.js +40 -40
- package/lib/server/utils/linuxUtils.js +71 -0
- package/lib/server/utils/network.js +217 -0
- package/lib/server/utils/nodePlatform.js +148 -0
- package/lib/server/utils/pipeTransport.js +84 -0
- package/lib/server/utils/processLauncher.js +238 -0
- package/lib/server/utils/profiler.js +65 -0
- package/lib/server/utils/socksProxy.js +511 -0
- package/lib/server/utils/spawnAsync.js +41 -0
- package/lib/server/utils/task.js +51 -0
- package/lib/server/utils/userAgent.js +98 -0
- package/lib/server/utils/wsServer.js +132 -0
- package/lib/server/utils/zipFile.js +74 -0
- package/lib/server/utils/zones.js +57 -0
- package/lib/server/webkit/protocol.d.js +16 -0
- package/lib/server/webkit/webkit.js +76 -63
- package/lib/server/webkit/wkAccessibility.js +161 -118
- package/lib/server/webkit/wkBrowser.js +163 -180
- package/lib/server/webkit/wkConnection.js +59 -83
- package/lib/server/webkit/wkExecutionContext.js +96 -73
- package/lib/server/webkit/wkInput.js +87 -75
- package/lib/server/webkit/wkInterceptableRequest.js +102 -95
- package/lib/server/webkit/wkPage.js +536 -645
- package/lib/server/webkit/wkProvisionalPage.js +45 -56
- package/lib/server/webkit/wkWorkers.js +77 -77
- package/lib/utils/isomorphic/ariaSnapshot.js +245 -128
- package/lib/utils/isomorphic/assert.js +31 -0
- package/lib/utils/isomorphic/builtins.js +90 -0
- package/lib/utils/isomorphic/colors.js +72 -0
- package/lib/utils/isomorphic/cssParser.js +123 -127
- package/lib/utils/isomorphic/cssTokenizer.js +436 -364
- package/lib/utils/isomorphic/headers.js +53 -0
- package/lib/utils/isomorphic/locatorGenerators.js +344 -349
- package/lib/utils/isomorphic/locatorParser.js +103 -106
- package/lib/utils/isomorphic/locatorUtils.js +63 -44
- package/lib/utils/isomorphic/manualPromise.js +115 -0
- package/lib/utils/isomorphic/mimeType.js +453 -22
- package/lib/utils/isomorphic/multimap.js +81 -0
- package/lib/utils/isomorphic/rtti.js +43 -0
- package/lib/utils/isomorphic/selectorParser.js +183 -193
- package/lib/utils/isomorphic/semaphore.js +54 -0
- package/lib/utils/isomorphic/stackTrace.js +158 -0
- package/lib/utils/isomorphic/stringUtils.js +113 -106
- package/lib/utils/isomorphic/time.js +44 -0
- package/lib/utils/isomorphic/timeoutRunner.js +67 -0
- package/lib/utils/isomorphic/traceUtils.js +52 -32
- package/lib/utils/isomorphic/types.js +16 -0
- package/lib/utils/isomorphic/urlMatch.js +114 -71
- package/lib/utils/isomorphic/utilityScriptSerializers.js +248 -0
- package/lib/utils.js +101 -0
- package/lib/utilsBundle.js +101 -76
- package/lib/utilsBundleImpl/index.js +114 -116
- package/lib/vite/htmlReport/index.html +26 -20
- package/lib/vite/recorder/assets/codeMirrorModule-DVQi6prl.js +24 -0
- package/lib/vite/recorder/assets/index-97EUAAbk.js +184 -0
- package/lib/vite/recorder/assets/{index-iA1aAGZg.css → index-eHBmevrY.css} +1 -1
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-DwAiTpyC.js +24 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-DkkRvn5X.js +265 -0
- package/lib/vite/traceViewer/assets/{xtermModule-BeNbaIVa.js → xtermModule-BoAIEibi.js} +7 -7
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +1 -0
- package/lib/vite/traceViewer/index.DvtSwn6E.js +2 -0
- package/lib/vite/traceViewer/index.html +4 -7
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/{uiMode.voC1ZiOQ.css → uiMode.BatfzHMG.css} +1 -1
- package/lib/vite/traceViewer/uiMode.Sdytl9wc.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +4 -7
- package/lib/zipBundle.js +32 -23
- package/lib/zipBundleImpl.js +4 -4
- package/package.json +7 -7
- package/types/protocol.d.ts +819 -127
- package/types/types.d.ts +196 -75
- package/bin/PrintDeps.exe +0 -0
- package/bin/README.md +0 -2
- package/lib/common/socksProxy.js +0 -569
- package/lib/common/timeoutSettings.js +0 -73
- package/lib/common/types.js +0 -5
- package/lib/image_tools/colorUtils.js +0 -98
- package/lib/image_tools/imageChannel.js +0 -70
- package/lib/protocol/transport.js +0 -82
- package/lib/server/ariaSnapshot.js +0 -33
- package/lib/server/isomorphic/utilityScriptSerializers.js +0 -226
- package/lib/server/recorder/recorderInTraceViewer.js +0 -144
- package/lib/utils/ascii.js +0 -31
- package/lib/utils/comparators.js +0 -153
- package/lib/utils/crypto.js +0 -171
- package/lib/utils/debug.js +0 -46
- package/lib/utils/debugLogger.js +0 -91
- package/lib/utils/env.js +0 -49
- package/lib/utils/eventsHelper.js +0 -38
- package/lib/utils/expectUtils.js +0 -33
- package/lib/utils/fileUtils.js +0 -205
- package/lib/utils/happy-eyeballs.js +0 -194
- package/lib/utils/headers.js +0 -52
- package/lib/utils/hostPlatform.js +0 -139
- package/lib/utils/httpServer.js +0 -237
- package/lib/utils/index.js +0 -368
- package/lib/utils/isomorphic/recorderUtils.js +0 -227
- package/lib/utils/linuxUtils.js +0 -78
- package/lib/utils/manualPromise.js +0 -109
- package/lib/utils/multimap.js +0 -75
- package/lib/utils/network.js +0 -160
- package/lib/utils/processLauncher.js +0 -248
- package/lib/utils/profiler.js +0 -53
- package/lib/utils/rtti.js +0 -44
- package/lib/utils/semaphore.js +0 -51
- package/lib/utils/sequence.js +0 -64
- package/lib/utils/spawnAsync.js +0 -45
- package/lib/utils/stackTrace.js +0 -134
- package/lib/utils/task.js +0 -58
- package/lib/utils/time.js +0 -37
- package/lib/utils/timeoutRunner.js +0 -66
- package/lib/utils/traceUtils.js +0 -44
- package/lib/utils/userAgent.js +0 -105
- package/lib/utils/wsServer.js +0 -127
- package/lib/utils/zipFile.js +0 -75
- package/lib/utils/zones.js +0 -71
- package/lib/vite/recorder/assets/codeMirrorModule-AFvV6hAs.js +0 -24
- package/lib/vite/recorder/assets/index-_cTWgVuJ.js +0 -184
- package/lib/vite/traceViewer/assets/codeMirrorModule-KatbITLF.js +0 -24
- package/lib/vite/traceViewer/assets/inspectorTab-DdpLd2bb.js +0 -68
- package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +0 -1
- package/lib/vite/traceViewer/assets/workbench-CdYbzWFD.js +0 -9
- package/lib/vite/traceViewer/embedded.6m3UZh7r.js +0 -2
- package/lib/vite/traceViewer/embedded.html +0 -18
- package/lib/vite/traceViewer/embedded.w7WN2u1R.css +0 -1
- package/lib/vite/traceViewer/index.WUV-8boJ.js +0 -2
- package/lib/vite/traceViewer/inspectorTab.DEOUW62d.css +0 -1
- package/lib/vite/traceViewer/recorder.B_SY1GJM.css +0 -0
- package/lib/vite/traceViewer/recorder.OT2tVHgn.js +0 -2
- package/lib/vite/traceViewer/recorder.html +0 -17
- package/lib/vite/traceViewer/uiMode.BZBTyvGn.js +0 -5
- package/lib/vite/traceViewer/workbench.C-zR9ysA.css +0 -1
- /package/lib/vite/recorder/assets/{codeMirrorModule-ez37Vkbh.css → codeMirrorModule-C3UTv-Ge.css} +0 -0
- /package/lib/vite/traceViewer/{codeMirrorModule.ez37Vkbh.css → codeMirrorModule.C3UTv-Ge.css} +0 -0
- /package/lib/vite/traceViewer/{index.CrbWWHbf.css → index.CFOW-Ezb.css} +0 -0
- /package/lib/vite/traceViewer/{xtermModule.DSXBckUd.css → xtermModule.Beg8tuEN.css} +0 -0
package/lib/server/fetch.js
CHANGED
|
@@ -1,59 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var fetch_exports = {};
|
|
30
|
+
__export(fetch_exports, {
|
|
31
|
+
APIRequestContext: () => APIRequestContext,
|
|
32
|
+
BrowserContextAPIRequestContext: () => BrowserContextAPIRequestContext,
|
|
33
|
+
GlobalAPIRequestContext: () => GlobalAPIRequestContext
|
|
5
34
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
class APIRequestContext extends _instrumentation.SdkObject {
|
|
35
|
+
module.exports = __toCommonJS(fetch_exports);
|
|
36
|
+
var import_http = __toESM(require("http"));
|
|
37
|
+
var import_https = __toESM(require("https"));
|
|
38
|
+
var import_stream = require("stream");
|
|
39
|
+
var import_tls = require("tls");
|
|
40
|
+
var zlib = __toESM(require("zlib"));
|
|
41
|
+
var import_timeoutSettings = require("./timeoutSettings");
|
|
42
|
+
var import_utils = require("../utils");
|
|
43
|
+
var import_crypto = require("./utils/crypto");
|
|
44
|
+
var import_userAgent = require("./utils/userAgent");
|
|
45
|
+
var import_browserContext = require("./browserContext");
|
|
46
|
+
var import_cookieStore = require("./cookieStore");
|
|
47
|
+
var import_formData = require("./formData");
|
|
48
|
+
var import_instrumentation = require("./instrumentation");
|
|
49
|
+
var import_progress = require("./progress");
|
|
50
|
+
var import_socksClientCertificatesInterceptor = require("./socksClientCertificatesInterceptor");
|
|
51
|
+
var import_happyEyeballs = require("./utils/happyEyeballs");
|
|
52
|
+
var import_tracing = require("./trace/recorder/tracing");
|
|
53
|
+
class APIRequestContext extends import_instrumentation.SdkObject {
|
|
54
|
+
constructor(parent) {
|
|
55
|
+
super(parent, "request-context");
|
|
56
|
+
this.fetchResponses = /* @__PURE__ */ new Map();
|
|
57
|
+
this.fetchLog = /* @__PURE__ */ new Map();
|
|
58
|
+
this._activeProgressControllers = /* @__PURE__ */ new Set();
|
|
59
|
+
APIRequestContext.allInstances.add(this);
|
|
60
|
+
}
|
|
61
|
+
static {
|
|
62
|
+
this.Events = {
|
|
63
|
+
Dispose: "dispose",
|
|
64
|
+
Request: "request",
|
|
65
|
+
RequestFinished: "requestfinished"
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
static {
|
|
69
|
+
this.allInstances = /* @__PURE__ */ new Set();
|
|
70
|
+
}
|
|
43
71
|
static findResponseBody(guid) {
|
|
44
72
|
for (const request of APIRequestContext.allInstances) {
|
|
45
73
|
const body = request.fetchResponses.get(guid);
|
|
46
|
-
if (body)
|
|
74
|
+
if (body)
|
|
75
|
+
return body;
|
|
47
76
|
}
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
constructor(parent) {
|
|
51
|
-
super(parent, 'request-context');
|
|
52
|
-
this.fetchResponses = new Map();
|
|
53
|
-
this.fetchLog = new Map();
|
|
54
|
-
this._activeProgressControllers = new Set();
|
|
55
|
-
this._closeReason = void 0;
|
|
56
|
-
APIRequestContext.allInstances.add(this);
|
|
77
|
+
return void 0;
|
|
57
78
|
}
|
|
58
79
|
_disposeImpl() {
|
|
59
80
|
APIRequestContext.allInstances.delete(this);
|
|
@@ -66,140 +87,138 @@ class APIRequestContext extends _instrumentation.SdkObject {
|
|
|
66
87
|
this.fetchLog.delete(fetchUid);
|
|
67
88
|
}
|
|
68
89
|
_storeResponseBody(body) {
|
|
69
|
-
const uid = (0,
|
|
90
|
+
const uid = (0, import_crypto.createGuid)();
|
|
70
91
|
this.fetchResponses.set(uid, body);
|
|
71
92
|
return uid;
|
|
72
93
|
}
|
|
73
94
|
async fetch(params, metadata) {
|
|
74
|
-
var _params$method;
|
|
75
95
|
const defaults = this._defaultOptions();
|
|
76
96
|
const headers = {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
97
|
+
"user-agent": defaults.userAgent,
|
|
98
|
+
"accept": "*/*",
|
|
99
|
+
"accept-encoding": "gzip,deflate,br"
|
|
80
100
|
};
|
|
81
101
|
if (defaults.extraHTTPHeaders) {
|
|
82
|
-
for (const {
|
|
83
|
-
name,
|
|
84
|
-
value
|
|
85
|
-
} of defaults.extraHTTPHeaders) setHeader(headers, name, value);
|
|
102
|
+
for (const { name, value } of defaults.extraHTTPHeaders)
|
|
103
|
+
setHeader(headers, name, value);
|
|
86
104
|
}
|
|
87
105
|
if (params.headers) {
|
|
88
|
-
for (const {
|
|
89
|
-
name,
|
|
90
|
-
value
|
|
91
|
-
} of params.headers) setHeader(headers, name, value);
|
|
106
|
+
for (const { name, value } of params.headers)
|
|
107
|
+
setHeader(headers, name, value);
|
|
92
108
|
}
|
|
93
|
-
const requestUrl = new URL((0,
|
|
109
|
+
const requestUrl = new URL((0, import_utils.constructURLBasedOnBaseURL)(defaults.baseURL, params.url));
|
|
94
110
|
if (params.encodedParams) {
|
|
95
111
|
requestUrl.search = params.encodedParams;
|
|
96
112
|
} else if (params.params) {
|
|
97
|
-
for (const {
|
|
98
|
-
name,
|
|
99
|
-
value
|
|
100
|
-
} of params.params) requestUrl.searchParams.append(name, value);
|
|
113
|
+
for (const { name, value } of params.params)
|
|
114
|
+
requestUrl.searchParams.append(name, value);
|
|
101
115
|
}
|
|
102
116
|
const credentials = this._getHttpCredentials(requestUrl);
|
|
103
|
-
if (
|
|
104
|
-
|
|
117
|
+
if (credentials?.send === "always")
|
|
118
|
+
setBasicAuthorizationHeader(headers, credentials);
|
|
119
|
+
const method = params.method?.toUpperCase() || "GET";
|
|
105
120
|
const proxy = defaults.proxy;
|
|
106
121
|
let agent;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
122
|
+
if (proxy?.server !== "per-context")
|
|
123
|
+
agent = (0, import_utils.createProxyAgent)(proxy, requestUrl);
|
|
124
|
+
let maxRedirects = params.maxRedirects ?? (defaults.maxRedirects ?? 20);
|
|
125
|
+
maxRedirects = maxRedirects === 0 ? -1 : maxRedirects;
|
|
110
126
|
const timeout = defaults.timeoutSettings.timeout(params);
|
|
111
|
-
const deadline = timeout && (0,
|
|
127
|
+
const deadline = timeout && (0, import_utils.monotonicTime)() + timeout;
|
|
112
128
|
const options = {
|
|
113
129
|
method,
|
|
114
130
|
headers,
|
|
115
131
|
agent,
|
|
116
|
-
maxRedirects
|
|
132
|
+
maxRedirects,
|
|
117
133
|
timeout,
|
|
118
134
|
deadline,
|
|
119
|
-
...(0,
|
|
135
|
+
...(0, import_socksClientCertificatesInterceptor.getMatchingTLSOptionsForOrigin)(this._defaultOptions().clientCertificates, requestUrl.origin),
|
|
120
136
|
__testHookLookup: params.__testHookLookup
|
|
121
137
|
};
|
|
122
|
-
|
|
123
|
-
|
|
138
|
+
if (params.ignoreHTTPSErrors || defaults.ignoreHTTPSErrors)
|
|
139
|
+
options.rejectUnauthorized = false;
|
|
124
140
|
const postData = serializePostData(params, headers);
|
|
125
|
-
if (postData)
|
|
126
|
-
|
|
127
|
-
const
|
|
141
|
+
if (postData)
|
|
142
|
+
setHeader(headers, "content-length", String(postData.byteLength));
|
|
143
|
+
const controller = new import_progress.ProgressController(metadata, this);
|
|
144
|
+
const fetchResponse = await controller.run((progress) => {
|
|
128
145
|
return this._sendRequestWithRetries(progress, requestUrl, options, postData, params.maxRetries);
|
|
129
146
|
});
|
|
130
147
|
const fetchUid = this._storeResponseBody(fetchResponse.body);
|
|
131
148
|
this.fetchLog.set(fetchUid, controller.metadata.log);
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
const failOnStatusCode = params.failOnStatusCode !== void 0 ? params.failOnStatusCode : !!defaults.failOnStatusCode;
|
|
150
|
+
if (failOnStatusCode && (fetchResponse.status < 200 || fetchResponse.status >= 400)) {
|
|
151
|
+
let responseText = "";
|
|
134
152
|
if (fetchResponse.body.byteLength) {
|
|
135
|
-
let text = fetchResponse.body.toString(
|
|
136
|
-
if (text.length >
|
|
137
|
-
|
|
153
|
+
let text = fetchResponse.body.toString("utf8");
|
|
154
|
+
if (text.length > 1e3)
|
|
155
|
+
text = text.substring(0, 997) + "...";
|
|
156
|
+
responseText = `
|
|
157
|
+
Response text:
|
|
158
|
+
${text}`;
|
|
138
159
|
}
|
|
139
160
|
throw new Error(`${fetchResponse.status} ${fetchResponse.statusText}${responseText}`);
|
|
140
161
|
}
|
|
141
|
-
return {
|
|
142
|
-
...fetchResponse,
|
|
143
|
-
fetchUid
|
|
144
|
-
};
|
|
162
|
+
return { ...fetchResponse, fetchUid };
|
|
145
163
|
}
|
|
146
164
|
_parseSetCookieHeader(responseUrl, setCookie) {
|
|
147
|
-
if (!setCookie)
|
|
165
|
+
if (!setCookie)
|
|
166
|
+
return [];
|
|
148
167
|
const url = new URL(responseUrl);
|
|
149
|
-
|
|
150
|
-
const defaultPath = '/' + url.pathname.substr(1).split('/').slice(0, -1).join('/');
|
|
168
|
+
const defaultPath = "/" + url.pathname.substr(1).split("/").slice(0, -1).join("/");
|
|
151
169
|
const cookies = [];
|
|
152
170
|
for (const header of setCookie) {
|
|
153
|
-
// Decode cookie value?
|
|
154
171
|
const cookie = parseCookie(header);
|
|
155
|
-
if (!cookie)
|
|
156
|
-
|
|
157
|
-
if (!cookie.domain)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
172
|
+
if (!cookie)
|
|
173
|
+
continue;
|
|
174
|
+
if (!cookie.domain)
|
|
175
|
+
cookie.domain = url.hostname;
|
|
176
|
+
else
|
|
177
|
+
(0, import_utils.assert)(cookie.domain.startsWith(".") || !cookie.domain.includes("."));
|
|
178
|
+
if (!(0, import_cookieStore.domainMatches)(url.hostname, cookie.domain))
|
|
179
|
+
continue;
|
|
180
|
+
if (!cookie.path || !cookie.path.startsWith("/"))
|
|
181
|
+
cookie.path = defaultPath;
|
|
161
182
|
cookies.push(cookie);
|
|
162
183
|
}
|
|
163
184
|
return cookies;
|
|
164
185
|
}
|
|
165
186
|
async _updateRequestCookieHeader(url, headers) {
|
|
166
|
-
if (getHeader(headers,
|
|
187
|
+
if (getHeader(headers, "cookie") !== void 0)
|
|
188
|
+
return;
|
|
167
189
|
const cookies = await this._cookies(url);
|
|
168
190
|
if (cookies.length) {
|
|
169
|
-
const valueArray = cookies.map(c => `${c.name}=${c.value}`);
|
|
170
|
-
setHeader(headers,
|
|
191
|
+
const valueArray = cookies.map((c) => `${c.name}=${c.value}`);
|
|
192
|
+
setHeader(headers, "cookie", valueArray.join("; "));
|
|
171
193
|
}
|
|
172
194
|
}
|
|
173
195
|
async _sendRequestWithRetries(progress, url, options, postData, maxRetries) {
|
|
174
|
-
|
|
175
|
-
(_maxRetries = maxRetries) !== null && _maxRetries !== void 0 ? _maxRetries : maxRetries = 0;
|
|
196
|
+
maxRetries ??= 0;
|
|
176
197
|
let backoff = 250;
|
|
177
198
|
for (let i = 0; i <= maxRetries; i++) {
|
|
178
199
|
try {
|
|
179
200
|
return await this._sendRequest(progress, url, options, postData);
|
|
180
201
|
} catch (e) {
|
|
181
|
-
e = (0,
|
|
182
|
-
if (maxRetries === 0)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
202
|
+
e = (0, import_socksClientCertificatesInterceptor.rewriteOpenSSLErrorIfNeeded)(e);
|
|
203
|
+
if (maxRetries === 0)
|
|
204
|
+
throw e;
|
|
205
|
+
if (i === maxRetries || options.deadline && (0, import_utils.monotonicTime)() + backoff > options.deadline)
|
|
206
|
+
throw new Error(`Failed after ${i + 1} attempt(s): ${e}`);
|
|
207
|
+
if (e.code !== "ECONNRESET")
|
|
208
|
+
throw e;
|
|
186
209
|
progress.log(` Received ECONNRESET, will retry after ${backoff}ms.`);
|
|
187
|
-
await new Promise(f => setTimeout(f, backoff));
|
|
210
|
+
await new Promise((f) => setTimeout(f, backoff));
|
|
188
211
|
backoff *= 2;
|
|
189
212
|
}
|
|
190
213
|
}
|
|
191
|
-
throw new Error(
|
|
214
|
+
throw new Error("Unreachable");
|
|
192
215
|
}
|
|
193
216
|
async _sendRequest(progress, url, options, postData) {
|
|
194
|
-
var _getHeader;
|
|
195
217
|
await this._updateRequestCookieHeader(url, options.headers);
|
|
196
|
-
const requestCookies =
|
|
197
|
-
const [name, value] = p.split(
|
|
198
|
-
return {
|
|
199
|
-
|
|
200
|
-
value
|
|
201
|
-
};
|
|
202
|
-
})) || [];
|
|
218
|
+
const requestCookies = getHeader(options.headers, "cookie")?.split(";").map((p) => {
|
|
219
|
+
const [name, value] = p.split("=").map((v) => v.trim());
|
|
220
|
+
return { name, value };
|
|
221
|
+
}) || [];
|
|
203
222
|
const requestEvent = {
|
|
204
223
|
url,
|
|
205
224
|
method: options.method,
|
|
@@ -209,14 +228,10 @@ class APIRequestContext extends _instrumentation.SdkObject {
|
|
|
209
228
|
};
|
|
210
229
|
this.emit(APIRequestContext.Events.Request, requestEvent);
|
|
211
230
|
return new Promise((fulfill, reject) => {
|
|
212
|
-
const requestConstructor = (url.protocol ===
|
|
213
|
-
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
...options,
|
|
217
|
-
agent
|
|
218
|
-
};
|
|
219
|
-
const startAt = (0, _utils.monotonicTime)();
|
|
231
|
+
const requestConstructor = (url.protocol === "https:" ? import_https.default : import_http.default).request;
|
|
232
|
+
const agent = options.agent || (url.protocol === "https:" ? import_happyEyeballs.httpsHappyEyeballsAgent : import_happyEyeballs.httpHappyEyeballsAgent);
|
|
233
|
+
const requestOptions = { ...options, agent };
|
|
234
|
+
const startAt = (0, import_utils.monotonicTime)();
|
|
220
235
|
let reusedSocketAt;
|
|
221
236
|
let dnsLookupAt;
|
|
222
237
|
let tcpConnectionAt;
|
|
@@ -226,13 +241,11 @@ class APIRequestContext extends _instrumentation.SdkObject {
|
|
|
226
241
|
let serverPort;
|
|
227
242
|
let securityDetails;
|
|
228
243
|
const listeners = [];
|
|
229
|
-
const request = requestConstructor(url, requestOptions, async response => {
|
|
230
|
-
const responseAt = (0,
|
|
231
|
-
const notifyRequestFinished =
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
// spec: http://www.softwareishard.com/blog/har-12-spec/#timings
|
|
235
|
-
const connectEnd = (_tlsHandshakeAt = tlsHandshakeAt) !== null && _tlsHandshakeAt !== void 0 ? _tlsHandshakeAt : tcpConnectionAt;
|
|
244
|
+
const request = requestConstructor(url, requestOptions, async (response) => {
|
|
245
|
+
const responseAt = (0, import_utils.monotonicTime)();
|
|
246
|
+
const notifyRequestFinished = (body2) => {
|
|
247
|
+
const endAt = (0, import_utils.monotonicTime)();
|
|
248
|
+
const connectEnd = tlsHandshakeAt ?? tcpConnectionAt;
|
|
236
249
|
const timings = {
|
|
237
250
|
send: requestFinishAt - startAt,
|
|
238
251
|
wait: responseAt - requestFinishAt,
|
|
@@ -247,11 +260,11 @@ class APIRequestContext extends _instrumentation.SdkObject {
|
|
|
247
260
|
requestEvent,
|
|
248
261
|
httpVersion: response.httpVersion,
|
|
249
262
|
statusCode: response.statusCode || 0,
|
|
250
|
-
statusMessage: response.statusMessage ||
|
|
263
|
+
statusMessage: response.statusMessage || "",
|
|
251
264
|
headers: response.headers,
|
|
252
265
|
rawHeaders: response.rawHeaders,
|
|
253
266
|
cookies,
|
|
254
|
-
body,
|
|
267
|
+
body: body2,
|
|
255
268
|
timings,
|
|
256
269
|
serverIPAddress,
|
|
257
270
|
serverPort,
|
|
@@ -259,36 +272,31 @@ class APIRequestContext extends _instrumentation.SdkObject {
|
|
|
259
272
|
};
|
|
260
273
|
this.emit(APIRequestContext.Events.RequestFinished, requestFinishedEvent);
|
|
261
274
|
};
|
|
262
|
-
progress.log(
|
|
263
|
-
for (const [name, value] of Object.entries(response.headers))
|
|
264
|
-
|
|
275
|
+
progress.log(`\u2190 ${response.statusCode} ${response.statusMessage}`);
|
|
276
|
+
for (const [name, value] of Object.entries(response.headers))
|
|
277
|
+
progress.log(` ${name}: ${value}`);
|
|
278
|
+
const cookies = this._parseSetCookieHeader(response.url || url.toString(), response.headers["set-cookie"]);
|
|
265
279
|
if (cookies.length) {
|
|
266
280
|
try {
|
|
267
281
|
await this._addCookies(cookies);
|
|
268
282
|
} catch (e) {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
await Promise.all(cookies.map(c => this._addCookies([c]).catch(() => {})));
|
|
283
|
+
await Promise.all(cookies.map((c) => this._addCookies([c]).catch(() => {
|
|
284
|
+
})));
|
|
272
285
|
}
|
|
273
286
|
}
|
|
274
287
|
if (redirectStatus.includes(response.statusCode) && options.maxRedirects >= 0) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
reject(new Error('Max redirect count exceeded'));
|
|
288
|
+
if (options.maxRedirects === 0) {
|
|
289
|
+
reject(new Error("Max redirect count exceeded"));
|
|
278
290
|
request.destroy();
|
|
279
291
|
return;
|
|
280
292
|
}
|
|
281
|
-
const headers = {
|
|
282
|
-
...options.headers
|
|
283
|
-
};
|
|
293
|
+
const headers = { ...options.headers };
|
|
284
294
|
removeHeader(headers, `cookie`);
|
|
285
|
-
|
|
286
|
-
// HTTP-redirect fetch step 13 (https://fetch.spec.whatwg.org/#http-redirect-fetch)
|
|
287
295
|
const status = response.statusCode;
|
|
288
296
|
let method = options.method;
|
|
289
|
-
if ((status === 301 || status === 302) && method ===
|
|
290
|
-
method =
|
|
291
|
-
postData =
|
|
297
|
+
if ((status === 301 || status === 302) && method === "POST" || status === 303 && !["GET", "HEAD"].includes(method)) {
|
|
298
|
+
method = "GET";
|
|
299
|
+
postData = void 0;
|
|
292
300
|
removeHeader(headers, `content-encoding`);
|
|
293
301
|
removeHeader(headers, `content-language`);
|
|
294
302
|
removeHeader(headers, `content-length`);
|
|
@@ -302,16 +310,12 @@ class APIRequestContext extends _instrumentation.SdkObject {
|
|
|
302
310
|
maxRedirects: options.maxRedirects - 1,
|
|
303
311
|
timeout: options.timeout,
|
|
304
312
|
deadline: options.deadline,
|
|
305
|
-
...(0,
|
|
313
|
+
...(0, import_socksClientCertificatesInterceptor.getMatchingTLSOptionsForOrigin)(this._defaultOptions().clientCertificates, url.origin),
|
|
306
314
|
__testHookLookup: options.__testHookLookup
|
|
307
315
|
};
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
// HTTP-redirect fetch step 4: If locationURL is null, then return response.
|
|
312
|
-
// Best-effort UTF-8 decoding, per spec it's US-ASCII only, but browsers are more lenient.
|
|
313
|
-
// Node.js parses it as Latin1 via std::v8::String, so we convert it to UTF-8.
|
|
314
|
-
const locationHeaderValue = Buffer.from((_response$headers$loc = response.headers.location) !== null && _response$headers$loc !== void 0 ? _response$headers$loc : '', 'latin1').toString('utf8');
|
|
316
|
+
if (options.rejectUnauthorized === false)
|
|
317
|
+
redirectOptions.rejectUnauthorized = false;
|
|
318
|
+
const locationHeaderValue = Buffer.from(response.headers.location ?? "", "latin1").toString("utf8");
|
|
315
319
|
if (locationHeaderValue) {
|
|
316
320
|
let locationURL;
|
|
317
321
|
try {
|
|
@@ -321,17 +325,18 @@ class APIRequestContext extends _instrumentation.SdkObject {
|
|
|
321
325
|
request.destroy();
|
|
322
326
|
return;
|
|
323
327
|
}
|
|
324
|
-
if (headers[
|
|
328
|
+
if (headers["host"])
|
|
329
|
+
headers["host"] = locationURL.host;
|
|
325
330
|
notifyRequestFinished();
|
|
326
331
|
fulfill(this._sendRequest(progress, locationURL, redirectOptions, postData));
|
|
327
332
|
request.destroy();
|
|
328
333
|
return;
|
|
329
334
|
}
|
|
330
335
|
}
|
|
331
|
-
if (response.statusCode === 401 && !getHeader(options.headers,
|
|
332
|
-
const auth = response.headers[
|
|
336
|
+
if (response.statusCode === 401 && !getHeader(options.headers, "authorization")) {
|
|
337
|
+
const auth = response.headers["www-authenticate"];
|
|
333
338
|
const credentials = this._getHttpCredentials(url);
|
|
334
|
-
if (auth
|
|
339
|
+
if (auth?.trim().startsWith("Basic") && credentials) {
|
|
335
340
|
setBasicAuthorizationHeader(options.headers, credentials);
|
|
336
341
|
notifyRequestFinished();
|
|
337
342
|
fulfill(this._sendRequest(progress, url, options, postData));
|
|
@@ -339,139 +344,123 @@ class APIRequestContext extends _instrumentation.SdkObject {
|
|
|
339
344
|
return;
|
|
340
345
|
}
|
|
341
346
|
}
|
|
342
|
-
response.on(
|
|
347
|
+
response.on("aborted", () => reject(new Error("aborted")));
|
|
343
348
|
const chunks = [];
|
|
344
349
|
const notifyBodyFinished = () => {
|
|
345
|
-
const
|
|
346
|
-
notifyRequestFinished(
|
|
350
|
+
const body2 = Buffer.concat(chunks);
|
|
351
|
+
notifyRequestFinished(body2);
|
|
347
352
|
fulfill({
|
|
348
353
|
url: response.url || url.toString(),
|
|
349
354
|
status: response.statusCode || 0,
|
|
350
|
-
statusText: response.statusMessage ||
|
|
355
|
+
statusText: response.statusMessage || "",
|
|
351
356
|
headers: toHeadersArray(response.rawHeaders),
|
|
352
|
-
body
|
|
357
|
+
body: body2
|
|
353
358
|
});
|
|
354
359
|
};
|
|
355
360
|
let body = response;
|
|
356
361
|
let transform;
|
|
357
|
-
const encoding = response.headers[
|
|
358
|
-
if (encoding ===
|
|
359
|
-
transform =
|
|
360
|
-
flush:
|
|
361
|
-
finishFlush:
|
|
362
|
+
const encoding = response.headers["content-encoding"];
|
|
363
|
+
if (encoding === "gzip" || encoding === "x-gzip") {
|
|
364
|
+
transform = zlib.createGunzip({
|
|
365
|
+
flush: zlib.constants.Z_SYNC_FLUSH,
|
|
366
|
+
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
|
362
367
|
});
|
|
363
|
-
} else if (encoding ===
|
|
364
|
-
transform =
|
|
365
|
-
flush:
|
|
366
|
-
finishFlush:
|
|
368
|
+
} else if (encoding === "br") {
|
|
369
|
+
transform = zlib.createBrotliDecompress({
|
|
370
|
+
flush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
|
371
|
+
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
|
367
372
|
});
|
|
368
|
-
} else if (encoding ===
|
|
369
|
-
transform =
|
|
373
|
+
} else if (encoding === "deflate") {
|
|
374
|
+
transform = zlib.createInflate();
|
|
370
375
|
}
|
|
371
376
|
if (transform) {
|
|
372
|
-
// Brotli and deflate decompressors throw if the input stream is empty.
|
|
373
377
|
const emptyStreamTransform = new SafeEmptyStreamTransform(notifyBodyFinished);
|
|
374
|
-
body = (0,
|
|
375
|
-
if (e)
|
|
378
|
+
body = (0, import_stream.pipeline)(response, emptyStreamTransform, transform, (e) => {
|
|
379
|
+
if (e)
|
|
380
|
+
reject(new Error(`failed to decompress '${encoding}' encoding: ${e.message}`));
|
|
376
381
|
});
|
|
377
|
-
body.on(
|
|
382
|
+
body.on("error", (e) => reject(new Error(`failed to decompress '${encoding}' encoding: ${e}`)));
|
|
378
383
|
} else {
|
|
379
|
-
body.on(
|
|
384
|
+
body.on("error", reject);
|
|
380
385
|
}
|
|
381
|
-
body.on(
|
|
382
|
-
body.on(
|
|
386
|
+
body.on("data", (chunk) => chunks.push(chunk));
|
|
387
|
+
body.on("end", notifyBodyFinished);
|
|
383
388
|
});
|
|
384
|
-
request.on(
|
|
385
|
-
listeners.push(
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
request.on("error", reject);
|
|
390
|
+
listeners.push(
|
|
391
|
+
import_utils.eventsHelper.addEventListener(this, APIRequestContext.Events.Dispose, () => {
|
|
392
|
+
reject(new Error("Request context disposed."));
|
|
393
|
+
request.destroy();
|
|
394
|
+
})
|
|
395
|
+
);
|
|
396
|
+
request.on("close", () => import_utils.eventsHelper.removeEventListeners(listeners));
|
|
397
|
+
request.on("socket", (socket) => {
|
|
392
398
|
if (request.reusedSocket) {
|
|
393
|
-
reusedSocketAt = (0,
|
|
399
|
+
reusedSocketAt = (0, import_utils.monotonicTime)();
|
|
394
400
|
return;
|
|
395
401
|
}
|
|
396
|
-
|
|
397
|
-
// happy eyeballs don't emit lookup and connect events, so we use our custom ones
|
|
398
|
-
const happyEyeBallsTimings = (0, _happyEyeballs.timingForSocket)(socket);
|
|
402
|
+
const happyEyeBallsTimings = (0, import_happyEyeballs.timingForSocket)(socket);
|
|
399
403
|
dnsLookupAt = happyEyeBallsTimings.dnsLookupAt;
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
// when using socks proxy, having the socket means the connection got established
|
|
424
|
-
if (agent instanceof _utilsBundle.SocksProxyAgent) (_tcpConnectionAt3 = tcpConnectionAt) !== null && _tcpConnectionAt3 !== void 0 ? _tcpConnectionAt3 : tcpConnectionAt = (0, _utils.monotonicTime)();
|
|
404
|
+
tcpConnectionAt = happyEyeBallsTimings.tcpConnectionAt;
|
|
405
|
+
listeners.push(
|
|
406
|
+
import_utils.eventsHelper.addEventListener(socket, "lookup", () => {
|
|
407
|
+
dnsLookupAt = (0, import_utils.monotonicTime)();
|
|
408
|
+
}),
|
|
409
|
+
import_utils.eventsHelper.addEventListener(socket, "connect", () => {
|
|
410
|
+
tcpConnectionAt = (0, import_utils.monotonicTime)();
|
|
411
|
+
}),
|
|
412
|
+
import_utils.eventsHelper.addEventListener(socket, "secureConnect", () => {
|
|
413
|
+
tlsHandshakeAt = (0, import_utils.monotonicTime)();
|
|
414
|
+
if (socket instanceof import_tls.TLSSocket) {
|
|
415
|
+
const peerCertificate = socket.getPeerCertificate();
|
|
416
|
+
securityDetails = {
|
|
417
|
+
protocol: socket.getProtocol() ?? void 0,
|
|
418
|
+
subjectName: peerCertificate.subject.CN,
|
|
419
|
+
validFrom: new Date(peerCertificate.valid_from).getTime() / 1e3,
|
|
420
|
+
validTo: new Date(peerCertificate.valid_to).getTime() / 1e3,
|
|
421
|
+
issuer: peerCertificate.issuer.CN
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
})
|
|
425
|
+
);
|
|
425
426
|
serverIPAddress = socket.remoteAddress;
|
|
426
427
|
serverPort = socket.remotePort;
|
|
427
428
|
});
|
|
428
|
-
request.on(
|
|
429
|
-
requestFinishAt = (0,
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
// http proxy
|
|
433
|
-
request.on('proxyConnect', () => {
|
|
434
|
-
var _tcpConnectionAt4;
|
|
435
|
-
(_tcpConnectionAt4 = tcpConnectionAt) !== null && _tcpConnectionAt4 !== void 0 ? _tcpConnectionAt4 : tcpConnectionAt = (0, _utils.monotonicTime)();
|
|
429
|
+
request.on("finish", () => {
|
|
430
|
+
requestFinishAt = (0, import_utils.monotonicTime)();
|
|
436
431
|
});
|
|
437
|
-
progress.log(
|
|
432
|
+
progress.log(`\u2192 ${options.method} ${url.toString()}`);
|
|
438
433
|
if (options.headers) {
|
|
439
|
-
for (const [name, value] of Object.entries(options.headers))
|
|
434
|
+
for (const [name, value] of Object.entries(options.headers))
|
|
435
|
+
progress.log(` ${name}: ${value}`);
|
|
440
436
|
}
|
|
441
437
|
if (options.deadline) {
|
|
442
438
|
const rejectOnTimeout = () => {
|
|
443
439
|
reject(new Error(`Request timed out after ${options.timeout}ms`));
|
|
444
440
|
request.destroy();
|
|
445
441
|
};
|
|
446
|
-
const remaining = options.deadline - (0,
|
|
442
|
+
const remaining = options.deadline - (0, import_utils.monotonicTime)();
|
|
447
443
|
if (remaining <= 0) {
|
|
448
444
|
rejectOnTimeout();
|
|
449
445
|
return;
|
|
450
446
|
}
|
|
451
447
|
request.setTimeout(remaining, rejectOnTimeout);
|
|
452
448
|
}
|
|
453
|
-
if (postData)
|
|
449
|
+
if (postData)
|
|
450
|
+
request.write(postData);
|
|
454
451
|
request.end();
|
|
455
452
|
});
|
|
456
453
|
}
|
|
457
454
|
_getHttpCredentials(url) {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
return
|
|
455
|
+
if (!this._defaultOptions().httpCredentials?.origin || url.origin.toLowerCase() === this._defaultOptions().httpCredentials?.origin?.toLowerCase())
|
|
456
|
+
return this._defaultOptions().httpCredentials;
|
|
457
|
+
return void 0;
|
|
461
458
|
}
|
|
462
459
|
}
|
|
463
|
-
|
|
464
|
-
APIRequestContext.Events = {
|
|
465
|
-
Dispose: 'dispose',
|
|
466
|
-
Request: 'request',
|
|
467
|
-
RequestFinished: 'requestfinished'
|
|
468
|
-
};
|
|
469
|
-
APIRequestContext.allInstances = new Set();
|
|
470
|
-
class SafeEmptyStreamTransform extends _stream.Transform {
|
|
460
|
+
class SafeEmptyStreamTransform extends import_stream.Transform {
|
|
471
461
|
constructor(onEmptyStreamCallback) {
|
|
472
462
|
super();
|
|
473
463
|
this._receivedSomeData = false;
|
|
474
|
-
this._onEmptyStreamCallback = void 0;
|
|
475
464
|
this._onEmptyStreamCallback = onEmptyStreamCallback;
|
|
476
465
|
}
|
|
477
466
|
_transform(chunk, encoding, callback) {
|
|
@@ -479,15 +468,17 @@ class SafeEmptyStreamTransform extends _stream.Transform {
|
|
|
479
468
|
callback(null, chunk);
|
|
480
469
|
}
|
|
481
470
|
_flush(callback) {
|
|
482
|
-
if (this._receivedSomeData)
|
|
471
|
+
if (this._receivedSomeData)
|
|
472
|
+
callback(null);
|
|
473
|
+
else
|
|
474
|
+
this._onEmptyStreamCallback();
|
|
483
475
|
}
|
|
484
476
|
}
|
|
485
477
|
class BrowserContextAPIRequestContext extends APIRequestContext {
|
|
486
478
|
constructor(context) {
|
|
487
479
|
super(context);
|
|
488
|
-
this._context = void 0;
|
|
489
480
|
this._context = context;
|
|
490
|
-
context.once(
|
|
481
|
+
context.once(import_browserContext.BrowserContext.Events.Close, () => this._disposeImpl());
|
|
491
482
|
}
|
|
492
483
|
tracing() {
|
|
493
484
|
return this._context.tracing;
|
|
@@ -500,6 +491,7 @@ class BrowserContextAPIRequestContext extends APIRequestContext {
|
|
|
500
491
|
return {
|
|
501
492
|
userAgent: this._context._options.userAgent || this._context._browser.userAgent(),
|
|
502
493
|
extraHTTPHeaders: this._context._options.extraHTTPHeaders,
|
|
494
|
+
failOnStatusCode: void 0,
|
|
503
495
|
httpCredentials: this._context._options.httpCredentials,
|
|
504
496
|
proxy: this._context._options.proxy || this._context._browser.options.proxy,
|
|
505
497
|
timeoutSettings: this._context._timeoutSettings,
|
|
@@ -514,43 +506,36 @@ class BrowserContextAPIRequestContext extends APIRequestContext {
|
|
|
514
506
|
async _cookies(url) {
|
|
515
507
|
return await this._context.cookies(url.toString());
|
|
516
508
|
}
|
|
517
|
-
async storageState() {
|
|
518
|
-
return this._context.storageState();
|
|
509
|
+
async storageState(indexedDB) {
|
|
510
|
+
return this._context.storageState(indexedDB);
|
|
519
511
|
}
|
|
520
512
|
}
|
|
521
|
-
exports.BrowserContextAPIRequestContext = BrowserContextAPIRequestContext;
|
|
522
513
|
class GlobalAPIRequestContext extends APIRequestContext {
|
|
523
514
|
constructor(playwright, options) {
|
|
524
515
|
super(playwright);
|
|
525
|
-
this._cookieStore = new
|
|
526
|
-
this._options = void 0;
|
|
527
|
-
this._origins = void 0;
|
|
528
|
-
this._tracing = void 0;
|
|
516
|
+
this._cookieStore = new import_cookieStore.CookieStore();
|
|
529
517
|
this.attribution.context = this;
|
|
530
|
-
const timeoutSettings = new
|
|
531
|
-
if (options.timeout !==
|
|
532
|
-
|
|
533
|
-
if (proxy !== null && proxy !== void 0 && proxy.server) {
|
|
534
|
-
let url = proxy === null || proxy === void 0 ? void 0 : proxy.server.trim();
|
|
535
|
-
if (!/^\w+:\/\//.test(url)) url = 'http://' + url;
|
|
536
|
-
proxy.server = url;
|
|
537
|
-
}
|
|
518
|
+
const timeoutSettings = new import_timeoutSettings.TimeoutSettings();
|
|
519
|
+
if (options.timeout !== void 0)
|
|
520
|
+
timeoutSettings.setDefaultTimeout(options.timeout);
|
|
538
521
|
if (options.storageState) {
|
|
539
|
-
this._origins = options.storageState.origins;
|
|
522
|
+
this._origins = options.storageState.origins?.map((origin) => ({ indexedDB: [], ...origin }));
|
|
540
523
|
this._cookieStore.addCookies(options.storageState.cookies || []);
|
|
541
524
|
}
|
|
542
|
-
(0,
|
|
525
|
+
(0, import_browserContext.verifyClientCertificates)(options.clientCertificates);
|
|
543
526
|
this._options = {
|
|
544
527
|
baseURL: options.baseURL,
|
|
545
|
-
userAgent: options.userAgent || (0,
|
|
528
|
+
userAgent: options.userAgent || (0, import_userAgent.getUserAgent)(),
|
|
546
529
|
extraHTTPHeaders: options.extraHTTPHeaders,
|
|
530
|
+
failOnStatusCode: !!options.failOnStatusCode,
|
|
547
531
|
ignoreHTTPSErrors: !!options.ignoreHTTPSErrors,
|
|
532
|
+
maxRedirects: options.maxRedirects,
|
|
548
533
|
httpCredentials: options.httpCredentials,
|
|
549
534
|
clientCertificates: options.clientCertificates,
|
|
550
|
-
proxy,
|
|
535
|
+
proxy: options.proxy,
|
|
551
536
|
timeoutSettings
|
|
552
537
|
};
|
|
553
|
-
this._tracing = new
|
|
538
|
+
this._tracing = new import_tracing.Tracing(this, options.tracesDir);
|
|
554
539
|
}
|
|
555
540
|
tracing() {
|
|
556
541
|
return this._tracing;
|
|
@@ -570,100 +555,86 @@ class GlobalAPIRequestContext extends APIRequestContext {
|
|
|
570
555
|
async _cookies(url) {
|
|
571
556
|
return this._cookieStore.cookies(url);
|
|
572
557
|
}
|
|
573
|
-
async storageState() {
|
|
558
|
+
async storageState(indexedDB = false) {
|
|
574
559
|
return {
|
|
575
560
|
cookies: this._cookieStore.allCookies(),
|
|
576
|
-
origins: this._origins || []
|
|
561
|
+
origins: (this._origins || []).map((origin) => ({ ...origin, indexedDB: indexedDB ? origin.indexedDB : [] }))
|
|
577
562
|
};
|
|
578
563
|
}
|
|
579
564
|
}
|
|
580
|
-
exports.GlobalAPIRequestContext = GlobalAPIRequestContext;
|
|
581
|
-
function createProxyAgent(proxy) {
|
|
582
|
-
var _proxyURL$protocol;
|
|
583
|
-
const proxyURL = new URL(proxy.server);
|
|
584
|
-
if ((_proxyURL$protocol = proxyURL.protocol) !== null && _proxyURL$protocol !== void 0 && _proxyURL$protocol.startsWith('socks')) return new _utilsBundle.SocksProxyAgent(proxyURL);
|
|
585
|
-
if (proxy.username) proxyURL.username = proxy.username;
|
|
586
|
-
if (proxy.password) proxyURL.password = proxy.password;
|
|
587
|
-
// TODO: We should use HttpProxyAgent conditional on proxyURL.protocol instead of always using CONNECT method.
|
|
588
|
-
return new _utilsBundle.HttpsProxyAgent(proxyURL);
|
|
589
|
-
}
|
|
590
565
|
function toHeadersArray(rawHeaders) {
|
|
591
566
|
const result = [];
|
|
592
|
-
for (let i = 0; i < rawHeaders.length; i += 2)
|
|
593
|
-
name: rawHeaders[i],
|
|
594
|
-
value: rawHeaders[i + 1]
|
|
595
|
-
});
|
|
567
|
+
for (let i = 0; i < rawHeaders.length; i += 2)
|
|
568
|
+
result.push({ name: rawHeaders[i], value: rawHeaders[i + 1] });
|
|
596
569
|
return result;
|
|
597
570
|
}
|
|
598
571
|
const redirectStatus = [301, 302, 303, 307, 308];
|
|
599
572
|
function parseCookie(header) {
|
|
600
|
-
const raw = (0,
|
|
601
|
-
if (!raw)
|
|
573
|
+
const raw = (0, import_cookieStore.parseRawCookie)(header);
|
|
574
|
+
if (!raw)
|
|
575
|
+
return null;
|
|
602
576
|
const cookie = {
|
|
603
|
-
domain:
|
|
604
|
-
path:
|
|
577
|
+
domain: "",
|
|
578
|
+
path: "",
|
|
605
579
|
expires: -1,
|
|
606
580
|
httpOnly: false,
|
|
607
581
|
secure: false,
|
|
608
582
|
// From https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
|
|
609
583
|
// The cookie-sending behavior if SameSite is not specified is SameSite=Lax.
|
|
610
|
-
sameSite:
|
|
584
|
+
sameSite: "Lax",
|
|
611
585
|
...raw
|
|
612
586
|
};
|
|
613
587
|
return cookie;
|
|
614
588
|
}
|
|
615
589
|
function serializePostData(params, headers) {
|
|
616
|
-
(0,
|
|
617
|
-
if (params.jsonData !==
|
|
618
|
-
setHeader(headers,
|
|
619
|
-
return Buffer.from(params.jsonData,
|
|
590
|
+
(0, import_utils.assert)((params.postData ? 1 : 0) + (params.jsonData ? 1 : 0) + (params.formData ? 1 : 0) + (params.multipartData ? 1 : 0) <= 1, `Only one of 'data', 'form' or 'multipart' can be specified`);
|
|
591
|
+
if (params.jsonData !== void 0) {
|
|
592
|
+
setHeader(headers, "content-type", "application/json", true);
|
|
593
|
+
return Buffer.from(params.jsonData, "utf8");
|
|
620
594
|
} else if (params.formData) {
|
|
621
595
|
const searchParams = new URLSearchParams();
|
|
622
|
-
for (const {
|
|
623
|
-
name,
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
setHeader(headers, 'content-type', 'application/x-www-form-urlencoded', true);
|
|
627
|
-
return Buffer.from(searchParams.toString(), 'utf8');
|
|
596
|
+
for (const { name, value } of params.formData)
|
|
597
|
+
searchParams.append(name, value);
|
|
598
|
+
setHeader(headers, "content-type", "application/x-www-form-urlencoded", true);
|
|
599
|
+
return Buffer.from(searchParams.toString(), "utf8");
|
|
628
600
|
} else if (params.multipartData) {
|
|
629
|
-
const formData = new
|
|
601
|
+
const formData = new import_formData.MultipartFormData();
|
|
630
602
|
for (const field of params.multipartData) {
|
|
631
|
-
if (field.file)
|
|
603
|
+
if (field.file)
|
|
604
|
+
formData.addFileField(field.name, field.file);
|
|
605
|
+
else if (field.value)
|
|
606
|
+
formData.addField(field.name, field.value);
|
|
632
607
|
}
|
|
633
|
-
setHeader(headers,
|
|
608
|
+
setHeader(headers, "content-type", formData.contentTypeHeader(), true);
|
|
634
609
|
return formData.finish();
|
|
635
|
-
} else if (params.postData !==
|
|
636
|
-
setHeader(headers,
|
|
610
|
+
} else if (params.postData !== void 0) {
|
|
611
|
+
setHeader(headers, "content-type", "application/octet-stream", true);
|
|
637
612
|
return params.postData;
|
|
638
613
|
}
|
|
639
|
-
return
|
|
614
|
+
return void 0;
|
|
640
615
|
}
|
|
641
616
|
function setHeader(headers, name, value, keepExisting = false) {
|
|
642
|
-
const existing = Object.entries(headers).find(pair => pair[0].toLowerCase() === name.toLowerCase());
|
|
643
|
-
if (!existing)
|
|
617
|
+
const existing = Object.entries(headers).find((pair) => pair[0].toLowerCase() === name.toLowerCase());
|
|
618
|
+
if (!existing)
|
|
619
|
+
headers[name] = value;
|
|
620
|
+
else if (!keepExisting)
|
|
621
|
+
headers[existing[0]] = value;
|
|
644
622
|
}
|
|
645
623
|
function getHeader(headers, name) {
|
|
646
|
-
const existing = Object.entries(headers).find(pair => pair[0].toLowerCase() === name.toLowerCase());
|
|
647
|
-
return existing ? existing[1] :
|
|
624
|
+
const existing = Object.entries(headers).find((pair) => pair[0].toLowerCase() === name.toLowerCase());
|
|
625
|
+
return existing ? existing[1] : void 0;
|
|
648
626
|
}
|
|
649
627
|
function removeHeader(headers, name) {
|
|
650
628
|
delete headers[name];
|
|
651
629
|
}
|
|
652
|
-
function shouldBypassProxy(url, bypass) {
|
|
653
|
-
if (!bypass) return false;
|
|
654
|
-
const domains = bypass.split(',').map(s => {
|
|
655
|
-
s = s.trim();
|
|
656
|
-
if (!s.startsWith('.')) s = '.' + s;
|
|
657
|
-
return s;
|
|
658
|
-
});
|
|
659
|
-
const domain = '.' + url.hostname;
|
|
660
|
-
return domains.some(d => domain.endsWith(d));
|
|
661
|
-
}
|
|
662
630
|
function setBasicAuthorizationHeader(headers, credentials) {
|
|
663
|
-
const {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
631
|
+
const { username, password } = credentials;
|
|
632
|
+
const encoded = Buffer.from(`${username || ""}:${password || ""}`).toString("base64");
|
|
633
|
+
setHeader(headers, "authorization", `Basic ${encoded}`);
|
|
634
|
+
}
|
|
635
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
636
|
+
0 && (module.exports = {
|
|
637
|
+
APIRequestContext,
|
|
638
|
+
BrowserContextAPIRequestContext,
|
|
639
|
+
GlobalAPIRequestContext
|
|
640
|
+
});
|