query parameters null in get response

32 Views Asked by At

I'm developing an API with Symfony 6.4

I'm trying to do something as simple as collecting the query params that I send in a get request. But I receive null value in all the ways I'm trying to collect the 'page' data.

GET request: http://my-project.dev/posts/list?page=2

Controller:
#[Route(path: '/posts/list', name: 'list', methods: ['GET'])]
    public function list(Request $request): Response
    {
        $page = $request->get('page');
        $page = $request->query->get('page');
        $page = $request->attributes->get('page');

I'm out of ideas. Something I'm not seeing correctly? Thanks for the help

0

There are 0 best solutions below