@midwayjs/faas 3.10.11 → 3.10.12

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.
Files changed (2) hide show
  1. package/dist/framework.js +14 -2
  2. package/package.json +2 -2
package/dist/framework.js CHANGED
@@ -191,7 +191,7 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
191
191
  };
192
192
  }
193
193
  async invokeTriggerFunction(context, handlerMapping, options) {
194
- var _a;
194
+ var _a, _b;
195
195
  let funOptions = this.funMappingStore.get(handlerMapping);
196
196
  const isHttpFunction = options.isHttpFunction;
197
197
  if (!funOptions && isHttpFunction) {
@@ -200,12 +200,24 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
200
200
  const matchRes = core_1.PathToRegexpUtil.match(funOptions.fullUrlFlattenString)(context.path);
201
201
  context.req.pathParameters = matchRes['params'] || {};
202
202
  }
203
+ else {
204
+ // options request pass throuth to middleware
205
+ if (((_a = context.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'options') {
206
+ funOptions = {
207
+ url: context.path,
208
+ method: 'options',
209
+ requestMethod: 'options',
210
+ controllerMiddleware: [],
211
+ middleware: [],
212
+ };
213
+ }
214
+ }
203
215
  }
204
216
  if (!funOptions) {
205
217
  throw new Error(`function handler = ${handlerMapping} not found`);
206
218
  }
207
219
  context = this.getContext(context);
208
- if ((_a = this.configurationOptions.applicationAdapter) === null || _a === void 0 ? void 0 : _a.runContextHook) {
220
+ if ((_b = this.configurationOptions.applicationAdapter) === null || _b === void 0 ? void 0 : _b.runContextHook) {
209
221
  this.configurationOptions.applicationAdapter.runContextHook(context);
210
222
  }
211
223
  const result = await (await this.applyMiddleware(async (ctx, next) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/faas",
3
- "version": "3.10.11",
3
+ "version": "3.10.12",
4
4
  "main": "dist/index",
5
5
  "typings": "index.d.ts",
6
6
  "dependencies": {
@@ -45,5 +45,5 @@
45
45
  "url": "git@github.com:midwayjs/midway.git"
46
46
  },
47
47
  "license": "MIT",
48
- "gitHead": "df0db0aaa0e3ff168204e3d5cf1c534dccc9b15e"
48
+ "gitHead": "5fbc455a226942afc49bf414fcdbd2ef88d3db96"
49
49
  }