mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +03:00
fix(platform): fixed emulated browser detection in node.js environment; (#6055)
This commit is contained in:
+2
-2
@@ -64,7 +64,7 @@ export default isXHRAdapterSupported && function (config) {
|
||||
let contentType;
|
||||
|
||||
if (utils.isFormData(requestData)) {
|
||||
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
||||
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
||||
requestHeaders.setContentType(false); // Let the browser set it
|
||||
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
|
||||
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
||||
@@ -186,7 +186,7 @@ export default isXHRAdapterSupported && function (config) {
|
||||
// Add xsrf header
|
||||
// This is only done if running in a standard browser environment.
|
||||
// Specifically not if we're in a web worker, or react-native.
|
||||
if (platform.isStandardBrowserEnv) {
|
||||
if (platform.hasStandardBrowserEnv) {
|
||||
// Add xsrf header
|
||||
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
||||
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
|
||||
Reference in New Issue
Block a user