I am working on an old project using Symfony 3.4 and Guzzle 5.3.
In my code I have something like that:
$json = $this->serializer->serialize($objectInstance, 'json');
try {
$response = $this->client->post(
'documents',
[
"body" => $json,
]
);
dump(json_decode($response->getBody()->getContents()));
die();
} catch(Throwable $e) {
/** @var Request $request */
$request = $e->getRequest();
dump("Request");
dump($request->getBody()->getContents());
}
But the output I get is like this:
MyClass.php on line 55:
"Request"
MyClass.php on line 58:
""
So far, I am 100% sure that the $json I use as "body" param is a valid JSON Document and 100% not empty.
Any idea why I could have this behaviour? Maybe it's something I don't see, but I have try a lot and I cannot figure out why it doesn't work.