Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: passing body for graphql requests generated from aws-appsync-simulator #16

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading