|
@@ 59-69 (lines=11) @@
|
| 56 |
|
* @param array $headers |
| 57 |
|
* @return ResponseInterface |
| 58 |
|
*/ |
| 59 |
|
protected function get(string $path, array $query = [], array $headers = []): ResponseInterface |
| 60 |
|
{ |
| 61 |
|
$query = $this->getQueryForClientRequest($query); |
| 62 |
|
$headers = $this->getHeadersForClientRequest($headers); |
| 63 |
|
|
| 64 |
|
$options = array_merge(['query' => $query], $this->getClientOptions($headers)); |
| 65 |
|
|
| 66 |
|
$response = $this->request('GET', static::API_URL . $path, $options); |
| 67 |
|
|
| 68 |
|
return $response; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
/** |
| 72 |
|
* Efetua requisição POST no client |
|
@@ 78-87 (lines=10) @@
|
| 75 |
|
* @param array $headers |
| 76 |
|
* @return ResponseInterface |
| 77 |
|
*/ |
| 78 |
|
protected function post(string $path, array $query = [], array $headers = []): ResponseInterface |
| 79 |
|
{ |
| 80 |
|
$query = $this->getQueryForClientRequest($query); |
| 81 |
|
$headers = $this->getHeadersForClientRequest($headers); |
| 82 |
|
|
| 83 |
|
$options = array_merge(['form_params' => $query], $this->getClientOptions($headers)); |
| 84 |
|
$response = $this->request('POST', static::API_URL . $path, $options); |
| 85 |
|
|
| 86 |
|
return $response; |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
/** |
| 90 |
|
* Retorna os headers que serão utilizados |