@onekeyfe/hd-transport-emulator 1.1.12 → 1.1.13

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.js CHANGED
@@ -95,15 +95,15 @@ function request(options) {
95
95
  }
96
96
  });
97
97
  }
98
- axios__default["default"].interceptors.request.use(config => {
99
- var _a, _b;
98
+ axios__default["default"].interceptors.request.use((config) => {
99
+ var _a;
100
100
  if (typeof window !== 'undefined') {
101
101
  return config;
102
102
  }
103
103
  if ((_a = config.url) === null || _a === void 0 ? void 0 : _a.startsWith('http://localhost:21333')) {
104
- if (!((_b = config === null || config === void 0 ? void 0 : config.headers) === null || _b === void 0 ? void 0 : _b.Origin)) {
104
+ if (!config.headers.get('Origin')) {
105
105
  console.log('set node request origin');
106
- config.headers = Object.assign(Object.assign({}, config.headers), { Origin: 'https://jssdk.onekey.so' });
106
+ config.headers.set('Origin', 'https://jssdk.onekey.so');
107
107
  }
108
108
  }
109
109
  return config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-emulator",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "hardware emulator transport",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -24,10 +24,10 @@
24
24
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@onekeyfe/hd-shared": "1.1.12",
28
- "@onekeyfe/hd-transport": "1.1.12",
29
- "axios": "^0.27.2",
27
+ "@onekeyfe/hd-shared": "1.1.13",
28
+ "@onekeyfe/hd-transport": "1.1.13",
29
+ "axios": "1.12.2",
30
30
  "secure-json-parse": "^4.0.0"
31
31
  },
32
- "gitHead": "bd87ededa77c034409a557682dbc78014fcfa803"
32
+ "gitHead": "7eaf49349763fb6c63fbd0c2ecb69663c443a72c"
33
33
  }
package/src/http.ts CHANGED
@@ -1,4 +1,4 @@
1
- import axios, { AxiosRequestConfig } from 'axios';
1
+ import axios, { AxiosRequestConfig, InternalAxiosRequestConfig } from 'axios';
2
2
  import { HardwareError, HardwareErrorCode } from '@onekeyfe/hd-shared';
3
3
  import secureJSON from 'secure-json-parse';
4
4
 
@@ -66,19 +66,16 @@ export async function request(options: HttpRequestOptions) {
66
66
  }
67
67
  }
68
68
 
69
- axios.interceptors.request.use(config => {
69
+ axios.interceptors.request.use((config: InternalAxiosRequestConfig) => {
70
70
  if (typeof window !== 'undefined') {
71
71
  return config;
72
72
  }
73
73
  // node environment
74
74
  if (config.url?.startsWith('http://localhost:21333')) {
75
- if (!config?.headers?.Origin) {
75
+ if (!config.headers.get('Origin')) {
76
76
  console.log('set node request origin');
77
77
  // add Origin field for request headers
78
- config.headers = {
79
- ...config.headers,
80
- Origin: 'https://jssdk.onekey.so',
81
- };
78
+ config.headers.set('Origin', 'https://jssdk.onekey.so');
82
79
  }
83
80
  }
84
81
  return config;