Http client : One or more validation errors occurred error

Viewed 11

I have an error when I execute an http request to retrieve data with the POST method in my symfony project

Code :

class ServiceAPI
{
    private $client;

    public function __construct(HttpClientInterface $client)
    {
        $this->client = $client;
    }

    public function getData(): array
    {
        $response = $this->client->request(
            'POST',
            'http://mydomaine.net/Article/GetArticles',
            [
                'headers' => [
                    'Content-Type' => 'application/json',
                ],         
            ]
        );

        return $response->toArray();
    }
}

Image error : One or more validation errors occurred.

0 Answers
Related