@noah-libjs/request 0.0.53 → 0.0.56
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 +13 -7
- package/dist/types.d.ts +2 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -136,14 +136,20 @@ var Request = /*#__PURE__*/function (_EventEmitter) {
|
|
|
136
136
|
};
|
|
137
137
|
ins.interceptors.request.use(function (config) {
|
|
138
138
|
var _a;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
Object.entries(args).forEach(function (_ref) {
|
|
142
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
143
|
-
k = _ref2[0],
|
|
144
|
-
v = _ref2[1];
|
|
145
|
-
headers["X-Arg-".concat(k)] = encodeURI(v);
|
|
139
|
+
Request.logger.log('request', {
|
|
140
|
+
config: config
|
|
146
141
|
});
|
|
142
|
+
if (config.pure_req) return onRequest(config);
|
|
143
|
+
var headers = (_a = config.headers) !== null && _a !== void 0 ? _a : config.headers = {};
|
|
144
|
+
if (!config.ignore_x_arg) {
|
|
145
|
+
var args = getSearchParamsAll();
|
|
146
|
+
Object.entries(args).forEach(function (_ref) {
|
|
147
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
148
|
+
k = _ref2[0],
|
|
149
|
+
v = _ref2[1];
|
|
150
|
+
headers["X-Arg-".concat(k)] = encodeURI(v);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
147
153
|
_this2.emit('request', config);
|
|
148
154
|
// TODO: remove
|
|
149
155
|
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.56",
|
|
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.56",
|
|
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": "5b482ad7daba780c88a758f96086367228977c97"
|
|
36
36
|
}
|