Skip to content

Commit 5b54919

Browse files
author
kenberkeley
committed
CORS withCredentials
1 parent 5b78f71 commit 5b54919

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/services/xhr/jquery.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const xhr = ({ url, body = null, method = 'get' }) => {
77
type: method,
88
url: rootPath + url,
99
data: body
10+
// xhrFields: { // 跨域允许带上 cookie
11+
// withCredentials: [域名]
12+
// }
1013
})
1114
.done(defer.resolve)
1215
.fail(errHandler)

src/services/xhr/superAgent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const xhr = ({ url, body = null, method = 'get' }) => {
66
return new Promise((resolve, reject) => {
77
request[method.toLowerCase()](rootPath + url)
88
.send(body)
9+
// 跨域允许带上 cookie(http://visionmedia.github.io/superagent/#cors)
910
// .withCredentials()
1011
.end((err, re) => {
1112
if (err)

src/services/xhr/superagent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const xhr = ({ url, body = null, method = 'get' }) => {
66
return new Promise((resolve, reject) => {
77
request[method.toLowerCase()](rootPath + url)
88
.send(body)
9+
// 跨域允许带上 cookie(http://visionmedia.github.io/superagent/#cors)
910
// .withCredentials()
1011
.end((err, re) => {
1112
if (err)

0 commit comments

Comments
 (0)