Created
January 8, 2021 15:15
-
-
Save silviot/4b062421a2bc6e128ffe666873060cda to your computer and use it in GitHub Desktop.
Apply patch to jsdom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This PR lays unmerged, so we apply it with this script: | |
# https://github.com/jsdom/jsdom/pull/3073 | |
find node_modules/ -name xhr-utils.js -exec patch -N -r- {} ./jsdom.patch \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/xhr-utils.js.orig 2021-01-06 16:00:27.029643588 +0100 | |
+++ node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/xhr-utils.js 2021-01-06 16:06:04.662096891 +0100 | |
@@ -93,7 +93,9 @@ | |
} | |
const acahStr = response.headers["access-control-allow-headers"]; | |
const acah = new Set(acahStr ? acahStr.trim().toLowerCase().split(headerListSeparatorRegexp) : []); | |
- const forbiddenHeaders = Object.keys(flag.requestHeaders).filter(header => { | |
+ const forbiddenHeaders = acah.has("*") ? | |
+ [] : | |
+ Object.keys(flag.requestHeaders).filter(header => { | |
const lcHeader = header.toLowerCase(); | |
return !simpleHeaders.has(lcHeader) && !acah.has(lcHeader); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To apply the fix from jsdom/jsdom#3073 before it's merged you can add the above files to your project and add the following to your package.json:
Only tested on Linux.