Skip to content

Commit

Permalink
chore: update generated MSW script
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasphil committed Dec 9, 2024
1 parent 625ad02 commit bf6fcd4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ fileignoreconfig:
- filename: lefthook.yml
checksum: ceb00460bb36a9b13ccbbc927598aa8757913d04d518f5092a9aa6926261cdc3
- filename: public/mockServiceWorker.js
checksum: daa620c709c07eed0da19b78818e0eb25ccc63951147fcaf50d6816fd14e777d
checksum: a3099205a43a7863559fd4f0a10c87bccf637fa61fdb587fd2a4ca2810f962ef
- filename: src/config/locale.ts
checksum: bce8adac9f7e05e5ed3d339f9b9a9d8bd2234a4663ddb1eafd110127cbbe4d9b
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"build:storybook": "storybook build",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write --ignore-unknown .",
"eslint:check": "eslint --max-warnings=0",
"eslint:check": "eslint --max-warnings=0 --no-warn-ignored",
"eslint:fix": "npm run eslint:check -- --fix",
"audit:licenses": "license-checker --production --excludePrivatePackages --excludePackages @digitalservicebund/ris-ui@$(cat package.json | jq -r '.version') --onlyAllow \"$(. ./parse-allowed-licenses.sh)\" --csv --out ./frontend-license-report.csv",
"typecheck": "vue-tsc",
Expand Down
18 changes: 10 additions & 8 deletions public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* - Please do NOT serve this file on production.
*/

const PACKAGE_VERSION = '2.6.0'
const INTEGRITY_CHECKSUM = '07a8241b182f8a246a7cd39894799a9e'
const PACKAGE_VERSION = '2.6.6'
const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()

Expand Down Expand Up @@ -192,12 +192,14 @@ async function getResponse(event, client, requestId) {
const requestClone = request.clone()

function passthrough() {
const headers = Object.fromEntries(requestClone.headers.entries())

// Remove internal MSW request header so the passthrough request
// complies with any potential CORS preflight checks on the server.
// Some servers forbid unknown request headers.
delete headers['x-msw-intention']
// Cast the request headers to a new Headers instance
// so the headers can be manipulated with.
const headers = new Headers(requestClone.headers)

// Remove the "accept" header value that marked this request as passthrough.
// This prevents request alteration and also keeps it compliant with the
// user-defined CORS policies.
headers.delete('accept', 'msw/passthrough')

return fetch(requestClone, { headers })
}
Expand Down

0 comments on commit bf6fcd4

Please sign in to comment.