Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
fix: aliyun gateway accept number
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Apr 14, 2020
1 parent d89c188 commit 55c77b3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/serverless-fc-starter/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class FCRuntime extends ServerlessLightRuntime {
return this.defaultInvokeHandler.apply(this, args);
}
return handler.apply(handler, args);
}).then(result => {
}).then((result) => {
if (res.headersSent) {
return;
}
Expand All @@ -79,6 +79,12 @@ export class FCRuntime extends ServerlessLightRuntime {
ctx.type = 'application/json';
}
ctx.body = JSON.stringify(data);
} else {
// 阿里云网关必须返回字符串
if (!ctx.type) {
ctx.type = 'text/plain';
}
ctx.body = data + '';
}

if (res.setHeader) {
Expand Down

0 comments on commit 55c77b3

Please sign in to comment.