Skip to content

Commit e1ab824

Browse files
committed
- add credentials default value same-origin in fetch api
1 parent f3be32c commit e1ab824

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Logs
22

3+
## v3.0.5 (upcoming)
4+
5+
- add `credentials` default value `same-origin` in fetch api
6+
7+
38
## v3.0.4
49

510
- extend default timeout from 20s to 40s to reduce some possibly edge cases

dist/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@
120120
};
121121
xhrpar = function(u, o, p){
122122
var c, that, k, v;
123-
c = import$({}, o);
123+
c = import$({
124+
credentials: 'same-origin'
125+
}, o);
124126
if (p.json) {
125127
c.body = JSON.stringify(p.json);
126128
(c.headers || (c.headers = {}))['Content-Type'] = 'application/json; charset=UTF-8';

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ if !(ld$?) =>
4747
ns = {svg: "http://www.w3.org/2000/svg"}
4848

4949
xhrpar = (u, o, p) ->
50-
c = {} <<< o
50+
# set credentials to default value `sample-origin`
51+
# to prevent from `omit` default value in earlier version of browsers.
52+
c = {credentials: \same-origin} <<< o
5153
if p.json =>
5254
c <<< body: JSON.stringify(p.json)
5355
c.{}headers['Content-Type'] = 'application/json; charset=UTF-8'

0 commit comments

Comments
 (0)