|
@@ 178-191 (lines=14) @@
|
| 175 |
|
* |
| 176 |
|
* @return ResponseInterface |
| 177 |
|
*/ |
| 178 |
|
protected function httpPut($path, array $parameters = [], array $requestHeaders = []) |
| 179 |
|
{ |
| 180 |
|
$requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 181 |
|
|
| 182 |
|
try { |
| 183 |
|
$response = $this->httpClient->sendRequest( |
| 184 |
|
$this->requestBuilder->create('PUT', $path, $requestHeaders, $this->createRequestBody($parameters)) |
| 185 |
|
); |
| 186 |
|
} catch (HttplugException\NetworkException $e) { |
| 187 |
|
throw HttpServerException::networkError($e); |
| 188 |
|
} |
| 189 |
|
|
| 190 |
|
return $response; |
| 191 |
|
} |
| 192 |
|
|
| 193 |
|
/** |
| 194 |
|
* Send a DELETE request with JSON-encoded parameters. |
|
@@ 202-215 (lines=14) @@
|
| 199 |
|
* |
| 200 |
|
* @return ResponseInterface |
| 201 |
|
*/ |
| 202 |
|
protected function httpDelete($path, array $parameters = [], array $requestHeaders = []) |
| 203 |
|
{ |
| 204 |
|
$requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 205 |
|
|
| 206 |
|
try { |
| 207 |
|
$response = $this->httpClient->sendRequest( |
| 208 |
|
$this->requestBuilder->create('DELETE', $path, $requestHeaders, $this->createRequestBody($parameters)) |
| 209 |
|
); |
| 210 |
|
} catch (HttplugException\NetworkException $e) { |
| 211 |
|
throw HttpServerException::networkError($e); |
| 212 |
|
} |
| 213 |
|
|
| 214 |
|
return $response; |
| 215 |
|
} |
| 216 |
|
|
| 217 |
|
/** |
| 218 |
|
* Create a JSON encoded version of an array of parameters. |