extractCookies example

if (empty($options['cookies'])) {
                    return $handler($request$options);
                } elseif (!($options['cookies'] instanceof CookieJarInterface)) {
                    throw new \InvalidArgumentException('cookies must be an instance of GuzzleHttp\Cookie\CookieJarInterface');
                }
                $cookieJar = $options['cookies'];
                $request = $cookieJar->withCookieHeader($request);

                return $handler($request$options)
                    ->then(
                        static function DResponseInterface $response) use ($cookieJar$request): ResponseInterface {
                            $cookieJar->extractCookies($request$response);

                            return $response;
                        }
                    );
            };
        };
    }

    /** * Middleware that throws exceptions for 4xx or 5xx responses when the * "http_errors" request option is set to true. * * @param BodySummarizerInterface|null $bodySummarizer The body summarizer to use in exception messages. * * @return callable(callable): callable Returns a function that accepts the next handler. */
Home | Imprint | This part of the site doesn't use cookies.