diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index 8c98d114b6..5a0fae426c 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -122,11 +122,10 @@ module.exports = function xhrAdapter(config) { }); } - // Add withCredentials to request if needed - if (config.withCredentials) { - request.withCredentials = true; + // Add withCredentials to request if needed. Explicit to set a true or false + if (typeof config.withCredentials !== 'undefined') { + request.withCredentials = !!config.withCredentials; } - // Add responseType to request if needed if (config.responseType) { try {