Skip to content
This repository was archived by the owner on Jul 24, 2025. It is now read-only.

Commit 055db95

Browse files
fix: axios common headers set
1 parent 52dd82c commit 055db95

31 files changed

Lines changed: 235 additions & 1267 deletions

dist/drivers/auth/basic.common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var basic = {
1414
},
1515
response: function (res) {
1616
var headers = this.drivers.http.getHeaders.call(this, res),
17-
token = headers.Authorization || headers.authorization;
17+
token = headers.Authorization || headers.authorization;
1818
return token;
1919
}
2020
};

dist/drivers/auth/basic.esm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var basic = {
1212
},
1313
response: function (res) {
1414
var headers = this.drivers.http.getHeaders.call(this, res),
15-
token = headers.Authorization || headers.authorization;
15+
token = headers.Authorization || headers.authorization;
1616
return token;
1717
}
1818
};

dist/drivers/auth/basic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
response: function (res) {
2020
var headers = this.drivers.http.getHeaders.call(this, res),
21-
token = headers.Authorization || headers.authorization;
21+
token = headers.Authorization || headers.authorization;
2222
return token;
2323
}
2424
};

dist/drivers/auth/bearer.common.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ var bearer = {
1414
},
1515
response: function (res) {
1616
var headers = this.drivers.http.getHeaders.call(this, res),
17-
token = headers.Authorization || headers.authorization;
18-
17+
token = headers.Authorization || headers.authorization;
1918
if (token) {
2019
token = token.split(/Bearer:?\s?/i);
2120
return token[token.length > 1 ? 1 : 0].trim();

dist/drivers/auth/bearer.esm.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ var bearer = {
1212
},
1313
response: function (res) {
1414
var headers = this.drivers.http.getHeaders.call(this, res),
15-
token = headers.Authorization || headers.authorization;
16-
15+
token = headers.Authorization || headers.authorization;
1716
if (token) {
1817
token = token.split(/Bearer:?\s?/i);
1918
return token[token.length > 1 ? 1 : 0].trim();

dist/drivers/auth/bearer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
},
1919
response: function (res) {
2020
var headers = this.drivers.http.getHeaders.call(this, res),
21-
token = headers.Authorization || headers.authorization;
22-
21+
token = headers.Authorization || headers.authorization;
2322
if (token) {
2423
token = token.split(/Bearer:?\s?/i);
2524
return token[token.length > 1 ? 1 : 0].trim();

dist/drivers/auth/devise.common.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var devise = {
1010
tokens: ['Token-Type', 'Access-Token', 'Client', 'Uid', 'Expiry', 'token-type', 'access-token', 'client', 'uid', 'expiry'],
1111
request: function (req, token) {
1212
var headers = {},
13-
tokens = token.split('|');
13+
tokens = token.split('|');
1414
var auth = this.drivers.deviseAuth || this.drivers.auth;
1515
auth.tokens.forEach(function (tokenName, index) {
1616
if (tokens[index]) {
@@ -21,16 +21,16 @@ var devise = {
2121
},
2222
response: function (res) {
2323
var token = [],
24-
headers = this.drivers.http.getHeaders.call(this, res);
25-
24+
headers = this.drivers.http.getHeaders.call(this, res);
2625
if (headers['access-token'] || headers['Access-Token']) {
2726
var auth = this.drivers.deviseAuth || this.drivers.auth;
2827
auth.tokens.forEach(function (tokenName) {
2928
if (headers[tokenName]) {
3029
token.push(headers[tokenName]);
3130
}
32-
}); // Check if access-token more recent than last one
31+
});
3332

33+
// Check if access-token more recent than last one
3434
if (!this.token() || parseInt(token[4], 10) >= parseInt(this.token().split('|')[4], 10)) {
3535
return token.join('|');
3636
}

dist/drivers/auth/devise.esm.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var devise = {
88
tokens: ['Token-Type', 'Access-Token', 'Client', 'Uid', 'Expiry', 'token-type', 'access-token', 'client', 'uid', 'expiry'],
99
request: function (req, token) {
1010
var headers = {},
11-
tokens = token.split('|');
11+
tokens = token.split('|');
1212
var auth = this.drivers.deviseAuth || this.drivers.auth;
1313
auth.tokens.forEach(function (tokenName, index) {
1414
if (tokens[index]) {
@@ -19,16 +19,16 @@ var devise = {
1919
},
2020
response: function (res) {
2121
var token = [],
22-
headers = this.drivers.http.getHeaders.call(this, res);
23-
22+
headers = this.drivers.http.getHeaders.call(this, res);
2423
if (headers['access-token'] || headers['Access-Token']) {
2524
var auth = this.drivers.deviseAuth || this.drivers.auth;
2625
auth.tokens.forEach(function (tokenName) {
2726
if (headers[tokenName]) {
2827
token.push(headers[tokenName]);
2928
}
30-
}); // Check if access-token more recent than last one
29+
});
3130

31+
// Check if access-token more recent than last one
3232
if (!this.token() || parseInt(token[4], 10) >= parseInt(this.token().split('|')[4], 10)) {
3333
return token.join('|');
3434
}

dist/drivers/auth/devise.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
tokens: ['Token-Type', 'Access-Token', 'Client', 'Uid', 'Expiry', 'token-type', 'access-token', 'client', 'uid', 'expiry'],
1515
request: function (req, token) {
1616
var headers = {},
17-
tokens = token.split('|');
17+
tokens = token.split('|');
1818
var auth = this.drivers.deviseAuth || this.drivers.auth;
1919
auth.tokens.forEach(function (tokenName, index) {
2020
if (tokens[index]) {
@@ -25,16 +25,16 @@
2525
},
2626
response: function (res) {
2727
var token = [],
28-
headers = this.drivers.http.getHeaders.call(this, res);
29-
28+
headers = this.drivers.http.getHeaders.call(this, res);
3029
if (headers['access-token'] || headers['Access-Token']) {
3130
var auth = this.drivers.deviseAuth || this.drivers.auth;
3231
auth.tokens.forEach(function (tokenName) {
3332
if (headers[tokenName]) {
3433
token.push(headers[tokenName]);
3534
}
36-
}); // Check if access-token more recent than last one
35+
});
3736

37+
// Check if access-token more recent than last one
3838
if (!this.token() || parseInt(token[4], 10) >= parseInt(this.token().split('|')[4], 10)) {
3939
return token.join('|');
4040
}

dist/drivers/http/axios.1.x.common.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ var axios_1_x = {
1414
},
1515
interceptor: function (req, res) {
1616
var _this = this;
17-
1817
if (req) {
1918
this.plugins.http.interceptors.request.use(function (request) {
2019
req.call(_this, request);
@@ -24,7 +23,6 @@ var axios_1_x = {
2423
return Promise.reject(error);
2524
});
2625
}
27-
2826
if (res) {
2927
this.plugins.http.interceptors.response.use(function (response) {
3028
res.call(_this, response);
@@ -33,7 +31,6 @@ var axios_1_x = {
3331
if (error && error.response) {
3432
res.call(_this, error.response);
3533
}
36-
3734
return Promise.reject(error);
3835
});
3936
}
@@ -53,7 +50,7 @@ var axios_1_x = {
5350
return res.headers;
5451
},
5552
setHeaders: function (req, headers) {
56-
req.headers.common = Object.assign({}, req.headers.common, headers);
53+
req.headers = Object.assign({}, req.headers, headers);
5754
}
5855
};
5956

0 commit comments

Comments
 (0)