Skip to content

Commit

Permalink
Merge pull request #16 from datalink/main
Browse files Browse the repository at this point in the history
fix: passing body for graphql requests generated from aws-appsync-simulator
  • Loading branch information
mnapoli authored Oct 28, 2024
2 parents b19b0ea + b5852ee commit ee31b94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 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.method === 'GET' ? '' : 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 All @@ -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',
Expand Down

0 comments on commit ee31b94

Please sign in to comment.