@noah-libjs/request 0.0.53 → 0.0.55
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 +10 -7
- package/dist/types.d.ts +2 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -136,14 +136,17 @@ var Request = /*#__PURE__*/function (_EventEmitter) {
|
|
|
136
136
|
};
|
|
137
137
|
ins.interceptors.request.use(function (config) {
|
|
138
138
|
var _a;
|
|
139
|
-
|
|
139
|
+
if (config.pure_req) return onRequest(config);
|
|
140
140
|
var headers = (_a = config.headers) !== null && _a !== void 0 ? _a : config.headers = {};
|
|
141
|
-
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
if (!config.ignore_x_arg) {
|
|
142
|
+
var args = getSearchParamsAll();
|
|
143
|
+
Object.entries(args).forEach(function (_ref) {
|
|
144
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
145
|
+
k = _ref2[0],
|
|
146
|
+
v = _ref2[1];
|
|
147
|
+
headers["X-Arg-".concat(k)] = encodeURI(v);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
147
150
|
_this2.emit('request', config);
|
|
148
151
|
// TODO: remove
|
|
149
152
|
headers.Authorization = headers.Authorization || _this2.token || '';
|
package/dist/types.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface IRequest_AxiosRequestConfig<D = any> extends AxiosRequestConfig
|
|
|
8
8
|
errText?: string;
|
|
9
9
|
ignore_usr?: boolean;
|
|
10
10
|
ignore_env?: boolean;
|
|
11
|
+
ignore_x_arg?: boolean;
|
|
12
|
+
pure_req?: boolean;
|
|
11
13
|
}
|
|
12
14
|
export interface IRequest_ResponseError<D = any> {
|
|
13
15
|
msg: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noah-libjs/request",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.55",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@noah-libjs/utils": "^0.0.
|
|
24
|
+
"@noah-libjs/utils": "^0.0.55",
|
|
25
25
|
"axios": "^0.26.1",
|
|
26
26
|
"store": "2.x"
|
|
27
27
|
},
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"keywords": [],
|
|
33
33
|
"author": "",
|
|
34
34
|
"license": "MIT",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "43779f40fafd0e816e1a48f6202b9be207959a44"
|
|
36
36
|
}
|