Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpFoundation] getPayload throws JsonException if request body is empty. #50490

Closed
@wiseguy1394

Description

@wiseguy1394

Symfony version(s) affected

6.3.0

Description

If I call $request->getPayload() it throws a JsonException.

What is the intended behavior?
In my opinion throwing an exception is fine, but @throws Symfony\Component\HttpFoundation\Exception\JsonException on the method would be nice.

How to reproduce

Call getPayload on request object in a controller and make POST request with empty body.

Possible Solution

Add @throws Symfony\Component\HttpFoundation\Exception\JsonException

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions