From 0298c1fc02916c492be4208002101dfe83f98ee1 Mon Sep 17 00:00:00 2001 From: Scott Davey Date: Thu, 24 Oct 2024 18:46:32 +1100 Subject: [PATCH] fix: passing body for graphql requests generated from aws-appsync-simulator --- src/apiGateway.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apiGateway.ts b/src/apiGateway.ts index b3d153d..c3b52e4 100644 --- a/src/apiGateway.ts +++ b/src/apiGateway.ts @@ -34,7 +34,7 @@ export function httpRequestToEvent(request: Request): APIGatewayProxyEventV2 { } ); - const bodyString = request.method === 'GET' ? '' : request.body.toString('utf8'); + const bodyString = 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('; ') : []; @@ -61,7 +61,7 @@ export function httpRequestToEvent(request: Request): APIGatewayProxyEventV2 { method: request.method, path: request.path, protocol: request.protocol, - sourceIp: request.ip, + sourceIp: String(request.ip), userAgent: request.header('User-Agent') ?? '', }, accountId: '123456789012',