zmdms-utils 0.0.95 → 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.
@@ -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.95",
3
+ "version": "0.0.96",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
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 */