@faasjs/http 0.0.2-beta.267 → 0.0.2-beta.276
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/lib/index.d.ts +1 -0
- package/lib/index.es.js +9 -8
- package/lib/index.js +9 -8
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
package/lib/index.es.js
CHANGED
|
@@ -339,22 +339,22 @@ class Http {
|
|
|
339
339
|
var _a;
|
|
340
340
|
await next();
|
|
341
341
|
this.logger.debug('组装网关配置');
|
|
342
|
-
this.logger.debug('%
|
|
342
|
+
this.logger.debug('%j', data);
|
|
343
343
|
const config = data.config.plugins ?
|
|
344
344
|
deepMerge(data.config.plugins[this.name || this.type], { config: this.config }) :
|
|
345
345
|
{ config: this.config };
|
|
346
346
|
// 根据文件及文件夹名生成路径
|
|
347
347
|
if (!config.config.path) {
|
|
348
|
-
config.config.path = '
|
|
349
|
-
if (config.config.path === '
|
|
350
|
-
config.config.path = '
|
|
348
|
+
config.config.path = '/' + ((_a = data.name) === null || _a === void 0 ? void 0 : _a.replace(/_/g, '/').replace(/\/index$/, ''));
|
|
349
|
+
if (config.config.path === '/index')
|
|
350
|
+
config.config.path = '/';
|
|
351
351
|
if (config.config.ignorePathPrefix) {
|
|
352
|
-
config.config.path = config.config.path.replace(new RegExp('
|
|
353
|
-
if (config.config.path === '
|
|
354
|
-
config.config.path = '
|
|
352
|
+
config.config.path = config.config.path.replace(new RegExp('^' + config.config.ignorePathPrefix), '');
|
|
353
|
+
if (config.config.path === '')
|
|
354
|
+
config.config.path = '/';
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
this.logger.debug('组装完成 %
|
|
357
|
+
this.logger.debug('组装完成 %j', config);
|
|
358
358
|
// 引用服务商部署插件
|
|
359
359
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
360
360
|
const Provider = require(config.provider.type).Provider;
|
|
@@ -379,6 +379,7 @@ class Http {
|
|
|
379
379
|
async onInvoke(data, next) {
|
|
380
380
|
var _a, _b;
|
|
381
381
|
this.headers = data.event.headers || Object.create(null);
|
|
382
|
+
this.body = data.event.body;
|
|
382
383
|
this.params = Object.create(null);
|
|
383
384
|
this.response = { headers: Object.create(null) };
|
|
384
385
|
if (data.event.body)
|
package/lib/index.js
CHANGED
|
@@ -343,22 +343,22 @@ class Http {
|
|
|
343
343
|
var _a;
|
|
344
344
|
await next();
|
|
345
345
|
this.logger.debug('组装网关配置');
|
|
346
|
-
this.logger.debug('%
|
|
346
|
+
this.logger.debug('%j', data);
|
|
347
347
|
const config = data.config.plugins ?
|
|
348
348
|
deep_merge.deepMerge(data.config.plugins[this.name || this.type], { config: this.config }) :
|
|
349
349
|
{ config: this.config };
|
|
350
350
|
// 根据文件及文件夹名生成路径
|
|
351
351
|
if (!config.config.path) {
|
|
352
|
-
config.config.path = '
|
|
353
|
-
if (config.config.path === '
|
|
354
|
-
config.config.path = '
|
|
352
|
+
config.config.path = '/' + ((_a = data.name) === null || _a === void 0 ? void 0 : _a.replace(/_/g, '/').replace(/\/index$/, ''));
|
|
353
|
+
if (config.config.path === '/index')
|
|
354
|
+
config.config.path = '/';
|
|
355
355
|
if (config.config.ignorePathPrefix) {
|
|
356
|
-
config.config.path = config.config.path.replace(new RegExp('
|
|
357
|
-
if (config.config.path === '
|
|
358
|
-
config.config.path = '
|
|
356
|
+
config.config.path = config.config.path.replace(new RegExp('^' + config.config.ignorePathPrefix), '');
|
|
357
|
+
if (config.config.path === '')
|
|
358
|
+
config.config.path = '/';
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
this.logger.debug('组装完成 %
|
|
361
|
+
this.logger.debug('组装完成 %j', config);
|
|
362
362
|
// 引用服务商部署插件
|
|
363
363
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
364
364
|
const Provider = require(config.provider.type).Provider;
|
|
@@ -383,6 +383,7 @@ class Http {
|
|
|
383
383
|
async onInvoke(data, next) {
|
|
384
384
|
var _a, _b;
|
|
385
385
|
this.headers = data.event.headers || Object.create(null);
|
|
386
|
+
this.body = data.event.body;
|
|
386
387
|
this.params = Object.create(null);
|
|
387
388
|
this.response = { headers: Object.create(null) };
|
|
388
389
|
if (data.event.body)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/http",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.276",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"lib"
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@faasjs/func": "^0.0.2-beta.
|
|
21
|
+
"@faasjs/func": "^0.0.2-beta.269",
|
|
22
22
|
"@types/debug": "*",
|
|
23
23
|
"@types/jest": "*",
|
|
24
24
|
"@types/node": "*",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"rollup-plugin-typescript2": "*",
|
|
27
27
|
"typescript": "*"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "7e82de988b4f9680004dd9de775a7762a053278c"
|
|
30
30
|
}
|