modifyRequest example

        if (isset($options['sink'])) {
            // TODO: Add more sink validation?             if (\is_bool($options['sink'])) {
                throw new InvalidArgumentException('sink must not be a boolean');
            }
        }

        if (isset($options['version'])) {
            $modify['version'] = $options['version'];
        }

        $request = Psr7\Utils::modifyRequest($request$modify);
        if ($request->getBody() instanceof Psr7\MultipartStream) {
            // Use a multipart/form-data POST if a Content-Type is not set.             // Ensure that we don't have the header in different case and set the new value.             $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type']$options['_conditional']);
            $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
                .$request->getBody()->getBoundary();
        }

        // Merge in conditional headers if they are not present.         if (isset($options['_conditional'])) {
            // Build up the changes so it's in a single clone of the message.
$size = $request->getBody()->getSize();
            if ($size !== null) {
                $modify['set_headers']['Content-Length'] = $size;
            } else {
                $modify['set_headers']['Transfer-Encoding'] = 'chunked';
            }
        }

        // Add the expect header if needed.         $this->addExpectHeader($request$options$modify);

        return $fn(Psr7\Utils::modifyRequest($request$modify)$options);
    }

    /** * Add expect header */
    private function addExpectHeader(RequestInterface $request, array $options, array &$modify): void
    {
        // Determine if the Expect header should be used         if ($request->hasHeader('Expect')) {
            return;
        }

        

    public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response)
    {
        if (\strpos((string) $response->getStatusCode(), '3') !== 0
            || !$response->hasHeader('Location')
        ) {
            return $response;
        }

        $this->guardMax($request$response$options);
        $nextRequest = $this->modifyRequest($request$options$response);

        // If authorization is handled by curl, unset it if URI is cross-origin.         if (Psr7\UriComparator::isCrossOrigin($request->getUri()$nextRequest->getUri()) && defined('\CURLOPT_HTTPAUTH')) {
            unset(
                $options['curl'][\CURLOPT_HTTPAUTH],
                $options['curl'][\CURLOPT_USERPWD]
            );
        }

        if (isset($options['allow_redirects']['on_redirect'])) {
            ($options['allow_redirects']['on_redirect'])(
                
Home | Imprint | This part of the site doesn't use cookies.