/** * */ protected function handleResponse($request) { $this->progress->onResponse($this->httpResponse); $this->createStream($request); $response = new Response($this->httpResponse->getCode(), $this->httpResponse->getHeaders(), $this->stream, $this->httpResponse->getVersion(), $this->httpResponse->getReasonPhrase()); if (!$this->options['stream']) { return $request->on('end', function () use($response) { $this->resolveResponse($response); }); } $this->resolveResponse($response); }
/** * Return response code * * @return int */ public function getCode() { return $this->code ?: $this->clientResponse->getCode(); }
/** * Transform a React Response to a valid PSR7 ResponseInterface instance. * * @param ReactResponse $response * @param StreamInterface $body * * @return ResponseInterface */ private function buildResponse(ReactResponse $response, StreamInterface $body) { $body->rewind(); return $this->responseFactory->createResponse($response->getCode(), $response->getReasonPhrase(), $response->getHeaders(), $body, $response->getVersion()); }