|
@@ 62-71 (lines=10) @@
|
| 59 |
|
* |
| 60 |
|
* @throws NetworkException |
| 61 |
|
*/ |
| 62 |
|
public function sendGetRequest(string $path, array $parameters = []): ResponseInterface |
| 63 |
|
{ |
| 64 |
|
$this->logger->debug('Sending GET request', ['path' => $path, 'parameters' => $parameters]); |
| 65 |
|
|
| 66 |
|
try { |
| 67 |
|
return $this->client->request('GET', $path, ['query' => $parameters]); |
| 68 |
|
} catch (TransferException $e) { |
| 69 |
|
throw new NetworkException('Request error', $e->getCode(), $e); |
| 70 |
|
} |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
/** |
| 74 |
|
* @param string $path Request path |
|
@@ 81-90 (lines=10) @@
|
| 78 |
|
* |
| 79 |
|
* @throws NetworkException |
| 80 |
|
*/ |
| 81 |
|
public function sendPostRequest(string $path, array $parameters = []): ResponseInterface |
| 82 |
|
{ |
| 83 |
|
$this->logger->debug('Sending POST request', ['path' => $path, 'parameters' => $parameters]); |
| 84 |
|
|
| 85 |
|
try { |
| 86 |
|
return $this->client->request('POST', $path, ['form_params' => $parameters]); |
| 87 |
|
} catch (TransferException $e) { |
| 88 |
|
throw new NetworkException('Request error', $e->getCode(), $e); |
| 89 |
|
} |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
/** |
| 93 |
|
* Make GET request and return response body |