zmdms-utils 0.0.94 → 0.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/dist/es/common.js +3 -0
- package/dist/es/request.d.ts +2 -0
- package/dist/es/request.js +4 -2
- package/package.json +1 -1
- package/src/common.ts +3 -0
- package/src/request.ts +6 -2
package/dist/es/common.js
CHANGED
package/dist/es/request.d.ts
CHANGED
package/dist/es/request.js
CHANGED
|
@@ -42,8 +42,10 @@ var AxiosRequest = /** @class */ (function () {
|
|
|
42
42
|
// 租户ID只有登录的时候才需要传递
|
|
43
43
|
// this.instanceAxios.defaults.headers.common["Tenant-Id"] =
|
|
44
44
|
// this.otherOptions.TenantId;
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
45
|
+
if (!this.otherOptions.noDefaultAuth) {
|
|
46
|
+
this.instanceAxios.defaults.headers.common["Authorization"] =
|
|
47
|
+
this.otherOptions.Authorization;
|
|
48
|
+
}
|
|
47
49
|
if (this.otherOptions.commonHeaders) {
|
|
48
50
|
Object.keys(this.otherOptions.commonHeaders).forEach(function (key) {
|
|
49
51
|
var _a;
|
package/package.json
CHANGED
package/src/common.ts
CHANGED
|
@@ -142,6 +142,9 @@ export function parseQueryParams(url: string): { [key: string]: string } {
|
|
|
142
142
|
* @returns 转换过后的结果
|
|
143
143
|
*/
|
|
144
144
|
export function unescapeString(input: string): string {
|
|
145
|
+
if (typeof input !== "string") {
|
|
146
|
+
return input;
|
|
147
|
+
}
|
|
145
148
|
if (!input) {
|
|
146
149
|
return "";
|
|
147
150
|
}
|
package/src/request.ts
CHANGED
|
@@ -69,8 +69,10 @@ export class AxiosRequest {
|
|
|
69
69
|
// 租户ID只有登录的时候才需要传递
|
|
70
70
|
// this.instanceAxios.defaults.headers.common["Tenant-Id"] =
|
|
71
71
|
// this.otherOptions.TenantId;
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
72
|
+
if (!this.otherOptions.noDefaultAuth) {
|
|
73
|
+
this.instanceAxios.defaults.headers.common["Authorization"] =
|
|
74
|
+
this.otherOptions.Authorization;
|
|
75
|
+
}
|
|
74
76
|
|
|
75
77
|
if (this.otherOptions.commonHeaders) {
|
|
76
78
|
Object.keys(this.otherOptions.commonHeaders).forEach((key) => {
|
|
@@ -428,6 +430,8 @@ export interface IOtherOptions {
|
|
|
428
430
|
TenantId?: string;
|
|
429
431
|
/** auth值 */
|
|
430
432
|
Authorization?: string;
|
|
433
|
+
/** 是否跳过默认的Authorization请求头,开启后只有外部自行传入时才会设置 */
|
|
434
|
+
noDefaultAuth?: boolean;
|
|
431
435
|
/** 公用请求头 */
|
|
432
436
|
commonHeaders?: { [prop: string]: any };
|
|
433
437
|
/** 请求认证TOKEN KEY */
|