You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since CacheEntry uses PumpStream for the response, attempting to use this middleware with gmponos/guzzle-log-middleware results in the following error:
StringHandler can not log request/response because the body is not seekable/readable.
The text was updated successfully, but these errors were encountered:
useGuzzleHttp\Middleware;
useGuzzleHttp\Psr7\Utils;
usePsr\Http\Message\ResponseInterface;
// Without this, we get the following error from the logger middleware://// "StringHandler can not log request/response because the body is not seekable/readable"//// It happens because the cache handler returns the body in the form of PumpStream which// is not rewindable. To fix, we simply read and copy the stream to a rewindable stream.//$handler->push(Middleware::mapResponse(
fn (ResponseInterface$response) => $response->withBody(
Psr7Utils::streamFor((string) $response->getBody())
)
));
// Add the cache middleware$handler->push($cacheMiddleware, 'cache');
I'm using the cache middleware w/ gmponos without error. I'm using Monolog rather than StringHandler, so perhaps it's StringHandler specifically that isn't compatible.
Since CacheEntry uses PumpStream for the response, attempting to use this middleware with gmponos/guzzle-log-middleware results in the following error:
The text was updated successfully, but these errors were encountered: