flamerest 1.0.95 → 1.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/REST.js +12 -1
- package/package.json +1 -1
package/REST.js
CHANGED
|
@@ -39,6 +39,12 @@ class FLAMEREST {
|
|
|
39
39
|
* Если авторизация по токену, то он сюда подставляется
|
|
40
40
|
*/
|
|
41
41
|
this.isAuthByJWTQuery = true;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Режим авторизации: Bearer|Link
|
|
45
|
+
*/
|
|
46
|
+
this.authMode = "Bearer";
|
|
47
|
+
|
|
42
48
|
this.token = null;
|
|
43
49
|
|
|
44
50
|
}
|
|
@@ -74,7 +80,12 @@ class FLAMEREST {
|
|
|
74
80
|
|
|
75
81
|
// Авторизация
|
|
76
82
|
if (this.isAuthByJWTQuery && isNeedToken === true && this.token !== null && this.token !== undefined && this.token !== 'undefined') {
|
|
77
|
-
|
|
83
|
+
switch (this.authMode) {
|
|
84
|
+
case 'Link':
|
|
85
|
+
url = url + (url.indexOf("?") === -1 ? "?" : "&") + "access-token=" + this.token;
|
|
86
|
+
default:
|
|
87
|
+
Object.assign(customHeaders, { 'Authorization': 'Bearer ' + this.token })
|
|
88
|
+
}
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
// Тело запроса
|