-
Bug
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
False
-
-
False
-
-
During refactoring and enabling the recommended Playwright ESLint rules, an error with
`expect(headers["x-proxy-test-header"]);` popped up: `Expect must have a corresponding matcher call playwright/valid-expect`
After investigating it, it truly hides an issue with `middleware.spec.ts` test. The expected header is not really present (appears as `undefined`), as you can see from printing the headers like that:
`
console.log("All headers:", headers);
console.log("Target header:", headers["x-proxy-test-header"]);
`
All headers: { 'access-control-allow-credentials': 'true', 'access-control-allow-origin': '***', 'cache-control': 'no-cache', 'content-length': '0', 'content-security-policy': "default-src 'self';base-uri 'self';font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self' 'unsafe-eval' https://cdn.segment.com;script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests;connect-src 'self' http: https:", date: 'Fri, 05 Sep 2025 06:29:26 GMT', 'referrer-policy': 'no-referrer', 'strict-transport-security': 'max-age=15552000; includeSubDomains', vary: 'Origin', 'x-content-type-options': 'nosniff', 'x-dns-prefetch-control': 'off', 'x-download-options': 'noopen', 'x-frame-options': 'SAMEORIGIN', 'x-permitted-cross-domain-policies': 'none', 'x-xss-protection': '0' } Target header: undefined