| @@ 56-79 (lines=24) @@ | ||
| 53 | /** |
|
| 54 | * {@inheritdoc} |
|
| 55 | */ |
|
| 56 | protected function sendInternalRequest(InternalRequestInterface $internalRequest) |
|
| 57 | { |
|
| 58 | try { |
|
| 59 | $response = $this->client->send($this->createRequest($internalRequest)); |
|
| 60 | } catch (RequestException $e) { |
|
| 61 | throw HttpAdapterException::cannotFetchUri( |
|
| 62 | $e->getRequest()->getUrl(), |
|
| 63 | $this->getName(), |
|
| 64 | $e->getMessage() |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | ||
| 68 | return $this->getConfiguration()->getMessageFactory()->createResponse( |
|
| 69 | (int) $response->getStatusCode(), |
|
| 70 | $response->getProtocolVersion(), |
|
| 71 | $response->getHeaders(), |
|
| 72 | BodyNormalizer::normalize( |
|
| 73 | function () use ($response) { |
|
| 74 | return $response->getBody()->detach(); |
|
| 75 | }, |
|
| 76 | $internalRequest->getMethod() |
|
| 77 | ) |
|
| 78 | ); |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * {@inheritdoc} |
|
| @@ 54-80 (lines=27) @@ | ||
| 51 | /** |
|
| 52 | * {@inheritdoc} |
|
| 53 | */ |
|
| 54 | protected function sendInternalRequest(InternalRequestInterface $internalRequest) |
|
| 55 | { |
|
| 56 | try { |
|
| 57 | $response = $this->client->send( |
|
| 58 | $this->createRequest($internalRequest), |
|
| 59 | $this->createOptions() |
|
| 60 | ); |
|
| 61 | } catch (RequestException $e) { |
|
| 62 | throw HttpAdapterException::cannotFetchUri( |
|
| 63 | $e->getRequest()->getUri(), |
|
| 64 | $this->getName(), |
|
| 65 | $e->getMessage() |
|
| 66 | ); |
|
| 67 | } |
|
| 68 | ||
| 69 | return $this->getConfiguration()->getMessageFactory()->createResponse( |
|
| 70 | (int) $response->getStatusCode(), |
|
| 71 | $response->getProtocolVersion(), |
|
| 72 | $response->getHeaders(), |
|
| 73 | BodyNormalizer::normalize( |
|
| 74 | function () use ($response) { |
|
| 75 | return $response->getBody()->detach(); |
|
| 76 | }, |
|
| 77 | $internalRequest->getMethod() |
|
| 78 | ) |
|
| 79 | ); |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * {@inheritdoc} |
|