amberframework / amber

A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
https://amberframework.org
MIT License
2.57k stars 204 forks source link

Requests with `content-type` `application/json` do not parse params correctly #1337

Open crimson-knight opened 11 months ago

crimson-knight commented 11 months ago

When sending a request with the header content-type: application/json with a body that has any kind of valid nested objects, the body is not parsed entirely.

For example:

a POST with content-type application/json in the header and body of:

{
  "ids": [1,2,3]
}

Would be parsed by Amber as:

params["ids"]  # "[1,2,3]" <- with a value as a type of String
{
 "example_object": {
    "another_object": "test"
  }
}

Would be parsed by Amber as:

params["example_object"] # "{ \"another_object\": \"test\" }" 

The expected result is that for this type of request that the entire request body be accessible as a JSON object.