Skip to content

Commit

Permalink
handle binary responses that have been base64 encoded (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
notclive authored Oct 17, 2021
1 parent d20c93b commit 5d6b4f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
13 changes: 6 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-lambda-local-dev",
"version": "1.4.1",
"version": "1.4.2",
"description": "typescript lambda local development server",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/local.lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export class LocalLambda {
this.enableCORS && this.setCORSHeaders(response);
response.statusCode = rs.statusCode;
response.writeHead(rs.statusCode, rs.headers);
response.end(rs.body);
const decodedResponseBody = Buffer.from(rs.body, rs.isBase64Encoded ? 'base64' : 'utf8');
response.end(decodedResponseBody);
});

});
Expand Down

0 comments on commit 5d6b4f7

Please sign in to comment.