Clue\React\Buzz\Io\Transaction::bufferResponse PHP Method

bufferResponse() public method

public bufferResponse ( Psr\Http\Message\ResponseInterface $response ) : PromiseInterface
$response Psr\Http\Message\ResponseInterface
return PromiseInterface Promise
    public function bufferResponse(ResponseInterface $response)
    {
        $stream = $response->getBody();
        // body is not streaming => already buffered
        if (!$stream instanceof ReadableStreamInterface) {
            return Promise\resolve($response);
        }
        // buffer stream and resolve with buffered body
        $messageFactory = $this->messageFactory;
        return BufferedSink::createPromise($stream)->then(function ($body) use($response, $messageFactory) {
            return $response->withBody($messageFactory->body($body));
        });
    }