We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a273116 + 519c93a commit 91830bdCopy full SHA for 91830bd
src/index.js
@@ -171,9 +171,11 @@ function create(defaults) {
171
customHeaders['content-type'] = 'application/json';
172
}
173
174
- const m =
175
- typeof document !== 'undefined' && document.cookie.match(RegExp('(^|; )' + options.xsrfCookieName + '=([^;]*)'));
176
- if (m) customHeaders[options.xsrfHeaderName] = decodeURIComponent(m[2]);
+ try {
+ customHeaders[options.xsrfHeaderName] = decodeURIComponent(
+ document.cookie.match(RegExp('(^|; )' + options.xsrfCookieName + '=([^;]*)'))[2]
177
+ );
178
+ } catch (e) {}
179
180
if (options.auth) {
181
customHeaders.authorization = options.auth;
0 commit comments