From 1995feff619c23de0e0f34248d37a49e90862a88 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 20 Aug 2021 19:48:21 +0200 Subject: [PATCH] Fix redirect logging --- src/Network/HTTPRequest.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Network/HTTPRequest.php b/src/Network/HTTPRequest.php index cf9b53a92..d47e969d5 100644 --- a/src/Network/HTTPRequest.php +++ b/src/Network/HTTPRequest.php @@ -197,12 +197,14 @@ class HTTPRequest implements IHTTPRequest $curlOptions[CURLOPT_BINARYTRANSFER] = 1; } + $logger = $this->logger; + $onRedirect = function( RequestInterface $request, ResponseInterface $response, UriInterface $uri - ) { - $this->logger->notice('Curl redirect.', ['url' => $request->getUri(), 'to' => $uri]); + ) use ($logger) { + $logger->notice('Curl redirect.', ['url' => $request->getUri(), 'to' => $uri]); }; $onHeaders = function (ResponseInterface $response) use ($opts) {