Skip to content

Commit

Permalink
Testing body is a buffer before converting it to a string
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttdav3y committed Oct 24, 2024
1 parent 0298c1f commit b5852ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/apiGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function httpRequestToEvent(request: Request): APIGatewayProxyEventV2 {
}
);

const bodyString = request.body.toString('utf8');
const bodyString = Buffer.isBuffer(request.body) ? request.body.toString('utf8') : '';
const shouldSendBase64 = request.method === 'GET' ? false : bodyString.includes('Content-Disposition: form-data');

const cookies = request.headers.cookie ? request.headers.cookie.split('; ') : [];
Expand Down

0 comments on commit b5852ee

Please sign in to comment.