Skip to content

Commit

Permalink
Get the User-Agent header from flag instead of from the request
Browse files Browse the repository at this point in the history
flag.userAgent is set from window.navigator.userAgent, which is the internal user agent set when the JSDOM instance is created. This ensures we are using the correct user agent.
  • Loading branch information
BehindTheMath authored and domenic committed Apr 30, 2018
1 parent 1e252e0 commit 4100e41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jsdom/living/xhr-utils.js
Expand Up @@ -349,7 +349,7 @@ function createClient(xhr) {
preflightRequestHeaders["Access-Control-Request-Headers"] = nonSimpleHeaders.join(", ");
}

preflightRequestHeaders["User-Agent"] = requestHeaders["User-Agent"];
preflightRequestHeaders["User-Agent"] = flag.userAgent;

flag.preflight = true;

Expand Down

0 comments on commit 4100e41

Please sign in to comment.