@playwright/experimental-ct-core
Advanced tools
Comparing version 1.49.0-alpha-2024-11-11 to 1.49.0-alpha-2024-11-12
@@ -41,6 +41,14 @@ "use strict"; | ||
} | ||
function isMswRequestPassthrough(headers) { | ||
var _headers$get; | ||
if (headers.get('x-msw-intention') === 'bypass') return true; | ||
// After MSW v2.6.4 | ||
// https://github.com/mswjs/msw/commit/2fa98c327acc51189f87789d9155c4ec57be2299 | ||
if ((_headers$get = headers.get('accept')) !== null && _headers$get !== void 0 && _headers$get.includes('msw/passthrough')) return true; | ||
return false; | ||
} | ||
async function globalFetch(...args) { | ||
if (args[0] && args[0] instanceof Request) { | ||
const request = args[0]; | ||
if (request.headers.get('x-msw-intention') === 'bypass') { | ||
if (isMswRequestPassthrough(request.headers)) { | ||
const cookieHeaders = await Promise.all([...currentlyInterceptingInContexts.keys()].map(async context => { | ||
@@ -55,3 +63,10 @@ const cookies = await context.cookies(request.url); | ||
headers.set('cookie', cookieHeaders[0]); | ||
headers.delete('x-msw-intention'); | ||
{ | ||
var _headers$get2; | ||
// pre 2.6.4 | ||
headers.delete('x-msw-intention'); | ||
// post 2.6.4 | ||
const accept = (_headers$get2 = headers.get('accept')) === null || _headers$get2 === void 0 ? void 0 : _headers$get2.split(',').filter(h => !h.includes('msw/')).join(','); | ||
if (accept) headers.set('accept', accept);else headers.delete('accept'); | ||
} | ||
args[0] = new Request(request.clone(), { | ||
@@ -58,0 +73,0 @@ headers |
{ | ||
"name": "@playwright/experimental-ct-core", | ||
"version": "1.49.0-alpha-2024-11-11", | ||
"version": "1.49.0-alpha-2024-11-12", | ||
"description": "Playwright Component Testing Helpers", | ||
@@ -29,6 +29,6 @@ "repository": { | ||
"dependencies": { | ||
"playwright-core": "1.49.0-alpha-2024-11-11", | ||
"playwright-core": "1.49.0-alpha-2024-11-12", | ||
"vite": "^5.2.8", | ||
"playwright": "1.49.0-alpha-2024-11-11" | ||
"playwright": "1.49.0-alpha-2024-11-12" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68329
1310
+ Addedplaywright@1.49.0-alpha-2024-11-12(transitive)
+ Addedplaywright-core@1.49.0-alpha-2024-11-12(transitive)
- Removedplaywright@1.49.0-alpha-2024-11-11(transitive)
- Removedplaywright-core@1.49.0-alpha-2024-11-11(transitive)