Skip to content

Commit

Permalink
when body is empty, buffer from throw error (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
vcfvct authored Nov 2, 2021
1 parent 02d48be commit bb61b8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "ts-lambda-local-dev",
"version": "1.4.3",
"version": "1.4.5",
"description": "typescript lambda local development server",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"typings": "dist/index.d.ts",
"scripts": {
"compile": "rm -rf dist/ && tsc -d --sourceMap",
"compile": "rm -rf dist/ && tsc --sourceMap",
"lint": "eslint --ext .ts src/",
"prepublishOnly": "npm run compile"
},
Expand Down
4 changes: 2 additions & 2 deletions src/local.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export class LocalLambda {
this.enableCORS && this.setCORSHeaders(response);
response.statusCode = rs.statusCode;
response.writeHead(rs.statusCode, rs.headers);
const decodedResponseBody = Buffer.from(rs.body, rs.isBase64Encoded ? 'base64' : 'utf8');
response.end(decodedResponseBody);
rs.body &&= Buffer.from(rs.body, rs.isBase64Encoded ? 'base64' : 'utf8');
response.end(rs.body);
});

});
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"experimentalDecorators": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"strict": true,
"strictPropertyInitialization": false,
Expand Down

0 comments on commit bb61b8f

Please sign in to comment.