|
@@ 81-90 (lines=10) @@
|
| 78 |
|
* |
| 79 |
|
* @return ResponseInterface |
| 80 |
|
*/ |
| 81 |
|
protected function httpGet($path, array $params = [], array $requestHeaders = []) |
| 82 |
|
{ |
| 83 |
|
if (count($params) > 0) { |
| 84 |
|
$path .= '?'.http_build_query($params); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
return $this->httpClient->sendRequest( |
| 88 |
|
$this->requestFactory->createRequest('GET', $path, $requestHeaders) |
| 89 |
|
); |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
/** |
| 93 |
|
* Send a POST request with JSON-encoded parameters. |
|
@@ 133-140 (lines=8) @@
|
| 130 |
|
* |
| 131 |
|
* @return ResponseInterface |
| 132 |
|
*/ |
| 133 |
|
protected function httpPut($path, array $params = [], array $requestHeaders = []) |
| 134 |
|
{ |
| 135 |
|
$requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 136 |
|
|
| 137 |
|
return $this->httpClient->sendRequest( |
| 138 |
|
$this->requestFactory->createRequest('PUT', $path, $requestHeaders, http_build_query($params)) |
| 139 |
|
); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* Send a DELETE request with JSON-encoded parameters. |
|
@@ 151-158 (lines=8) @@
|
| 148 |
|
* |
| 149 |
|
* @return ResponseInterface |
| 150 |
|
*/ |
| 151 |
|
protected function httpDelete($path, array $params = [], array $requestHeaders = []) |
| 152 |
|
{ |
| 153 |
|
$requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 154 |
|
|
| 155 |
|
return $this->httpClient->sendRequest( |
| 156 |
|
$this->requestFactory->createRequest('DELETE', $path, $requestHeaders, http_build_query($params)) |
| 157 |
|
); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
/** |
| 161 |
|
* Handle HTTP errors. |