-
Notifications
You must be signed in to change notification settings - Fork 52
Doesn't work with raw text bodies #14
Comments
Hi @beardyman, which version do you use? Maybe the PR #13 solves your problem. But this is not released yet. Further more there is another PR #15 in the pipeline which handles error pathes better. |
I'm using the latest version in npm(0.4.0). At first glance #13 looks like it would probably solve my issue of troubleshooting however it wouldn't handle the actual request. For non-JSON bodies it would have to either inspect the content type or try to parse as JSON and then fall back to plain text. What I'm suggesting would basically be
rather than:
|
In my fork I solved this by creating a new property called "parsedBody". That way we don't break the AWS APIGatewayProxyEvent defined body type which is a string or null. Also checking content-type header, if JSON I will add the result to the parsedBody body. This would allow for more parsers such as XML. Would be happy to submit a PR to this library but it is a breaking change. Full code at: https://github.com/capcito/aws-lambda-router/blob/develop/lib/proxyIntegration.js#L100
|
I setup a POST route with a handler and the handler never got invoked despite debug mode logging that it found a matching route. The logs just end there.
I was able to eventually reproduce the issue and the response was
Unexpected 'b'
.I'm working on a PR to handle text types and add debug logging when the mime type isn't valid but I wanted to bring this up. I got around it by handing that specific route prior to calling the route handler like so:
The text was updated successfully, but these errors were encountered: