From 7da478791e12a88bbc19803e1e38b17a0b87bcf1 Mon Sep 17 00:00:00 2001 From: regexowl Date: Tue, 17 Dec 2024 09:08:43 +0100 Subject: [PATCH] devDeps: Manually bump msw from 2.6.6 to 2.7.0 This bumps msw from 2.6.6 to 2.7.0 --- package-lock.json | 10 +++++----- package.json | 2 +- src/mockServiceWorker.js | 18 +++++++++++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 536b3939..204ab03f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -73,7 +73,7 @@ "madge": "8.0.0", "mini-css-extract-plugin": "2.9.1", "moment": "2.30.1", - "msw": "2.6.6", + "msw": "2.7.0", "npm-run-all": "4.1.5", "postcss-scss": "4.0.9", "react-chartjs-2": "5.2.0", @@ -14390,9 +14390,9 @@ "license": "MIT" }, "node_modules/msw": { - "version": "2.6.6", - "resolved": "https://registry.npmjs.org/msw/-/msw-2.6.6.tgz", - "integrity": "sha512-npfIIVRHKQX3Lw4aLWX4wBh+lQwpqdZNyJYB5K/+ktK8NhtkdsTxGK7WDrgknozcVyRI7TOqY6yBS9j2FTR+YQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/msw/-/msw-2.7.0.tgz", + "integrity": "sha512-BIodwZ19RWfCbYTxWTUfTXc+sg4OwjCAgxU1ZsgmggX/7S3LdUifsbUPJs61j0rWb19CZRGY5if77duhc0uXzw==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -14406,12 +14406,12 @@ "@open-draft/until": "^2.1.0", "@types/cookie": "^0.6.0", "@types/statuses": "^2.0.4", - "chalk": "^4.1.2", "graphql": "^16.8.1", "headers-polyfill": "^4.0.2", "is-node-process": "^1.2.0", "outvariant": "^1.4.3", "path-to-regexp": "^6.3.0", + "picocolors": "^1.1.1", "strict-event-emitter": "^0.5.1", "type-fest": "^4.26.1", "yargs": "^17.7.2" diff --git a/package.json b/package.json index 0aa0dc73..b772e8da 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "madge": "8.0.0", "mini-css-extract-plugin": "2.9.1", "moment": "2.30.1", - "msw": "2.6.6", + "msw": "2.7.0", "npm-run-all": "4.1.5", "postcss-scss": "4.0.9", "react-chartjs-2": "5.2.0", diff --git a/src/mockServiceWorker.js b/src/mockServiceWorker.js index fead0b3f..ec47a9a5 100644 --- a/src/mockServiceWorker.js +++ b/src/mockServiceWorker.js @@ -8,8 +8,8 @@ * - Please do NOT serve this file on production. */ -const PACKAGE_VERSION = '2.6.6' -const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074' +const PACKAGE_VERSION = '2.7.0' +const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f' const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') const activeClientIds = new Set() @@ -199,7 +199,19 @@ async function getResponse(event, client, requestId) { // 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') + const acceptHeader = headers.get('accept') + if (acceptHeader) { + const values = acceptHeader.split(',').map((value) => value.trim()) + const filteredValues = values.filter( + (value) => value !== 'msw/passthrough', + ) + + if (filteredValues.length > 0) { + headers.set('accept', filteredValues.join(', ')) + } else { + headers.delete('accept') + } + } return fetch(requestClone, { headers }) }