Skip to content

Commit b5852ee

Browse files
committed
Testing body is a buffer before converting it to a string
1 parent 0298c1f commit b5852ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/apiGateway.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function httpRequestToEvent(request: Request): APIGatewayProxyEventV2 {
3434
}
3535
);
3636

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

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

0 commit comments

Comments
 (0)