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 CHANGED
@@ -138,6 +138,9 @@ function parseQueryParams(url) {
138
138
  * @returns 转换过后的结果
139
139
  */
140
140
  function unescapeString(input) {
141
+ if (typeof input !== "string") {
142
+ return input;
143
+ }
141
144
  if (!input) {
142
145
  return "";
143
146
  }
@@ -61,6 +61,8 @@ interface IOtherOptions {
61
61
  TenantId?: string;
62
62
  /** auth值 */
63
63
  Authorization?: string;
64
+ /** 是否跳过默认的Authorization请求头,开启后只有外部自行传入时才会设置 */
65
+ noDefaultAuth?: boolean;
64
66
  /** 公用请求头 */
65
67
  commonHeaders?: {
66
68
  [prop: string]: any;
@@ -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.instanceAxios.defaults.headers.common["Authorization"] =
46
- this.otherOptions.Authorization;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-utils",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
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.instanceAxios.defaults.headers.common["Authorization"] =
73
- this.otherOptions.Authorization;
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 */