fix: passing body for graphql requests generated from aws-appsync-simulator #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I'm running a local version of AppSync (via
servereless-offline
)+ API Gateway (via this package) + Bref:I was finding all of my GraphQL queries and mutations were missing the body part of the request. I looked into it and found
local-api-gateway
was suppressing the body of the request.I have removed that conditional in this PR to pass the body whenever it's available, and all is working for my use case now.
I get the intent of the code, and I suspect it's not working because the payload, at least in my case, has
method
inrequest.requestContext.method
, and notrequest.method
. But I think it's not terrible to simplify things and just pass body if it's supplied, especially given the aims of this project to be minimally useful.I also added a tidy on L64 to cast
request.ip
as a string, because the Typescript indicatesrequest.ip
isstring|null
while the AWS payload must be astring
.Note I tried to spin up the tests and contribute a unit test, but I couldn't work out the dev steps to get them going. If you want me to work on some tests, give me some hints on how to get started and I'd be happy to do so.
Thanks, Scott