Category : http

I made two tests with exactly the same code except the returned status code of my request (200 for one test, and 201 for another test). Here the only difference between my two tests: return new JsonResponse(["id" => $transaction->getId()], Response::HTTP_OK); and return new JsonResponse(["id" => $transaction->getId()], Response::HTTP_CREATED); In the first case, no Set-Cookie header is ..

Read more

I tried recently to install symfony using the setup.exe in the official website. Because there are 2 ways to make websites using symfony for example to create a project instead of using this syntax : composer create-project symfony/website-skeleton project_name I will simply use : symfony new –full project_name because a lot of tutorials use the ..

Read more

I want to upload in chunks a file to a Nuxeo server : … use SymfonyContractsHttpClientHttpClientInterface; … public function __construct(HttpClientInterface $client) { $this->client = $client; } … $nbChunks = 5; for($chunkIdx = 0 ; $chunkIdx < $nbChunks ; $chunkIdx++) { $uploadResponse = $this->client->request(‘POST’, ‘http://192.168.128.101:8080/nuxeo/api/v1/upload/’ . $nuxeoBatchId . ‘/’ . $fileIdx, [ ‘headers’ => [ ‘Authorization’ ..

Read more

I’m using the Http Client to send a request to an external API. According to the documentation I can add default headers to a specific route like so: framework: http_client: scoped_clients: the_api: base_uri: ‘%env(the_url)%’ headers: Authorization: ‘Bearer %env(my_token)%’ That doesn’t work for me. I also tried this option: auth_bearer: ‘%env(my_token)%’ same effect. In the service ..

Read more