An API sends me a stream containing a zip archive of several files that I choose by providing their ids in the parameter SelectedIds
of my request.
I receive a PSR7 response that I pass to HttpFoundationFactory to return a Response that corresponds to what the Symfony controller should return.
(the goal is to download the zip in the client side browser.)
Here is the content of my controller method
$client = $this->getApiClient();
$user = $this->getUser();
$idList = [51,52,53];
$psr7ApiResponse = $client->post('/v1/get-zip', [
'headers' => [
'Authorization' => sprintf('Bearer %s', $user->getToken()),
],
'http_errors' => false,
'json' => [
'SelectedIds' => $idList,
],
]);
$httpFoundationFactory = new HttpFoundationFactory();
return $httpFoundationFactory->createResponse($psr7ApiResponse);
It works perfectly locally but on the server I receive nothing, blank page. Would you know which way I should look because I have no error log, it looks like the stream is empty but I don't know how to check.
I tested the API with postman and it's ok ; my controller sends me back a 200 as well