Skip to content

Commit

Permalink
fix: fc egg app body parse (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
echosoar authored Nov 16, 2020
1 parent e753359 commit 18c0aad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages-serverless/serverless-fc-starter/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ export class FCRuntime extends ServerlessLightRuntime {
// const rawBody = 'test';
// req.rawBody = rawBody;

// 应用下自行解决 bodyparser 的问题
if (!this.isAppMode) {
// 如果需要解析body并且body是个stream
if (
['post', 'put', 'delete'].indexOf(req.method.toLowerCase()) !== -1 &&
!req.body &&
typeof req.on === 'function'
) {
req.body = await getRawBody(req); // TODO: body parser
}
newReq = req;
Expand Down

0 comments on commit 18c0aad

Please sign in to comment.