uniapp-request-sdk 1.4.7 → 1.4.10
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/dist/index.d.ts +2 -2
- package/dist/index.esm.js +5 -5
- package/dist/index.umd.js +5 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ interface IParams {
|
|
|
26
26
|
/** 自定义得到token的函数,默认使用从客户端获取token的方式 */
|
|
27
27
|
getTokenFun?: () => Promise<string>;
|
|
28
28
|
/** 用户名,用于日志排查使用 */
|
|
29
|
-
|
|
29
|
+
username?: string;
|
|
30
30
|
}
|
|
31
31
|
declare function requestPromise(options?: RequestOptions & {
|
|
32
32
|
timeout: number;
|
|
@@ -35,7 +35,7 @@ declare class UniRequest {
|
|
|
35
35
|
/** 基准路径 */
|
|
36
36
|
private baseUrl;
|
|
37
37
|
/** 用户名 */
|
|
38
|
-
private
|
|
38
|
+
private username;
|
|
39
39
|
/** 错误处理函数 */
|
|
40
40
|
private onErrorHandler;
|
|
41
41
|
/** 默认请求头 */
|
package/dist/index.esm.js
CHANGED
|
@@ -73,7 +73,7 @@ var UniRequest = /*#__PURE__*/function () {
|
|
|
73
73
|
/** 基准路径 */
|
|
74
74
|
this.baseUrl = '';
|
|
75
75
|
/** 用户名 */
|
|
76
|
-
this.
|
|
76
|
+
this.username = '';
|
|
77
77
|
/** 错误处理函数 */
|
|
78
78
|
this.onErrorHandler = function (error) {
|
|
79
79
|
console.error(error);
|
|
@@ -126,15 +126,15 @@ var UniRequest = /*#__PURE__*/function () {
|
|
|
126
126
|
var appVersion = (_a = uni.getSystemInfoSync()) === null || _a === void 0 ? void 0 : _a.appVersion;
|
|
127
127
|
/** 如果是http开头的,则不需要加入baseUrl */
|
|
128
128
|
if (!/^https?:\/\//.test(url)) {
|
|
129
|
-
url = "".concat(this.baseUrl.replace(/\/$/, ''), "/").concat(params.url.replace(/^\//, ''), "?t=").concat(Date.now()
|
|
129
|
+
url = "".concat(this.baseUrl.replace(/\/$/, ''), "/").concat(params.url.replace(/^\//, ''), "?t=").concat(Date.now());
|
|
130
130
|
} else {
|
|
131
131
|
url = "".concat(params.url, "?t=").concat(Date.now());
|
|
132
132
|
}
|
|
133
133
|
var header = Object.assign(Object.assign(Object.assign({}, this.header), params.header), {
|
|
134
134
|
/** 添加日志上报的小程序版本 */
|
|
135
|
-
'X-Request-
|
|
136
|
-
/** 添加日志上报的小程序
|
|
137
|
-
'X-Request-
|
|
135
|
+
'X-Request-Appversion': appVersion,
|
|
136
|
+
/** 添加日志上报的小程序username */
|
|
137
|
+
'X-Request-Username': this.username
|
|
138
138
|
});
|
|
139
139
|
var requestedToken = false;
|
|
140
140
|
var retryCount = 0;
|
package/dist/index.umd.js
CHANGED
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
/** 基准路径 */
|
|
80
80
|
this.baseUrl = '';
|
|
81
81
|
/** 用户名 */
|
|
82
|
-
this.
|
|
82
|
+
this.username = '';
|
|
83
83
|
/** 错误处理函数 */
|
|
84
84
|
this.onErrorHandler = function (error) {
|
|
85
85
|
console.error(error);
|
|
@@ -132,15 +132,15 @@
|
|
|
132
132
|
var appVersion = (_a = uni.getSystemInfoSync()) === null || _a === void 0 ? void 0 : _a.appVersion;
|
|
133
133
|
/** 如果是http开头的,则不需要加入baseUrl */
|
|
134
134
|
if (!/^https?:\/\//.test(url)) {
|
|
135
|
-
url = "".concat(this.baseUrl.replace(/\/$/, ''), "/").concat(params.url.replace(/^\//, ''), "?t=").concat(Date.now()
|
|
135
|
+
url = "".concat(this.baseUrl.replace(/\/$/, ''), "/").concat(params.url.replace(/^\//, ''), "?t=").concat(Date.now());
|
|
136
136
|
} else {
|
|
137
137
|
url = "".concat(params.url, "?t=").concat(Date.now());
|
|
138
138
|
}
|
|
139
139
|
var header = Object.assign(Object.assign(Object.assign({}, this.header), params.header), {
|
|
140
140
|
/** 添加日志上报的小程序版本 */
|
|
141
|
-
'X-Request-
|
|
142
|
-
/** 添加日志上报的小程序
|
|
143
|
-
'X-Request-
|
|
141
|
+
'X-Request-Appversion': appVersion,
|
|
142
|
+
/** 添加日志上报的小程序username */
|
|
143
|
+
'X-Request-Username': this.username
|
|
144
144
|
});
|
|
145
145
|
var requestedToken = false;
|
|
146
146
|
var retryCount = 0;
|