Skip to content

Commit ab8b393

Browse files
authored
Added withCredentials option. (#36)
* Added withCredentials option. Don't know how to test this * Optimize character count
1 parent 28aa074 commit ab8b393

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default (function create(defaults) {
142142
}
143143
}
144144
}
145-
145+
146146
const fetchFunc = options.fetch || fetch;
147147
const customHeaders = {};
148148

@@ -172,7 +172,8 @@ export default (function create(defaults) {
172172
return fetchFunc(url, {
173173
method: options.method,
174174
body: data,
175-
headers: deepMerge(options.headers, customHeaders, true)
175+
headers: deepMerge(options.headers, customHeaders, true),
176+
credentials: options.withCredentials && 'include'
176177
}).then((res) => {
177178
let i;
178179
for (i in res) {

0 commit comments

Comments
 (0)