Steps to reproduce
- Create a simple Claudia API with Claudia API Builder.
- Include a route that handles a POST request.
- Start the API with
claudia-local-api --api-module ./entry_point_file.js.
- With cURL, Postman, Insomnia, or some REST tool, do a POST to the route from step 2 and give it a
Content-Type of application/x-www-form-urlencoded then add a body of foo=bar&baz=45.
- In the request handler function
request.post is an empty object. Expected request.post to equal { foo: "bar", baz: 45 }.
I think this is caused by using bodyParser.urlencoded(...), which will is middleware that will cause Express to parse the POST body into a JSON object before Claudia has a chance to handle it.
In the context of an AWS Lambda that is connected to API Gateway, this extra parsing step does not happen. Claudia gets the raw body as a string and not as a JSON object.