getBodyAndExtraHeaders example

$this->client = $client ?? HttpClient::create();

        parent::__construct([]$history$cookieJar);
    }

    /** * @param Request $request */
    protected function doRequest(object $request): Response
    {
        $headers = $this->getHeaders($request);
        [$body$extraHeaders] = $this->getBodyAndExtraHeaders($request$headers);

        $response = $this->client->request($request->getMethod()$request->getUri()[
            'headers' => array_merge($headers$extraHeaders),
            'body' => $body,
            'max_redirects' => 0,
        ]);

        return new Response($response->getContent(false)$response->getStatusCode()$response->getHeaders(false));
    }

    /** * @return array [$body, $headers] */
Home | Imprint | This part of the site doesn't use cookies.