Closed InjustFr closed 4 years ago
I've also had this issue while upgrading from 2.7.2 to 3.0.2. The first parameter in my post method within the controller is name, and I thus get an InvalidParameterException
with detail:
"Parameter \"name\" of value \"NULL\" violated a constraint \"This value should not be null.\"".
This occurs consistently even when stripping the body down to
{
"name": "Functional test template"
}
Controller uses
use FOS\RestBundle\Controller\Annotations as Rest;
* @Rest\RequestParam(name="name", nullable=false, requirements=@Type(type="string"))
My issue was solved by adding body_listener: true
to fos_rest.yml, I hadn't noticed this was one of the breaking changes between 2.x and 3.x
This indeed looks the cause here. So I am going to close here.
@Thewolfs Please leave a comment if enabled the body listener doesn't fix it for you.
Thank you @CraigPeden, this indeed fixes it
Hi,
I've upgraded to 3.0 from 2.8.2 and POST routes which were working fine before now won't
The body of the POST request seems to be completely ignored and not parsed into the request
Here is the body of my Request:
{"test": "test"}
Here is a repo with an example not working: Repo
If you upgrade to 3.0 it breaks
Maybe I'm doing something wrong, but I'm haven't managed to figure it out on my own
Thanks in advance for your help