| @@ 156-167 (lines=12) @@ | ||
| 153 | * |
|
| 154 | * @return ResponseInterface |
|
| 155 | */ |
|
| 156 | protected function httpPostRaw($path, $body, array $requestHeaders = []) |
|
| 157 | { |
|
| 158 | try { |
|
| 159 | $response = $this->httpClient->sendRequest( |
|
| 160 | $this->requestBuilder->create('POST', $path, $requestHeaders, $body) |
|
| 161 | ); |
|
| 162 | } catch (HttplugException\NetworkException $e) { |
|
| 163 | throw HttpServerException::networkError($e); |
|
| 164 | } |
|
| 165 | ||
| 166 | return $response; |
|
| 167 | } |
|
| 168 | ||
| 169 | /** |
|
| 170 | * Send a PUT request. |
|
| @@ 178-189 (lines=12) @@ | ||
| 175 | * |
|
| 176 | * @return ResponseInterface |
|
| 177 | */ |
|
| 178 | protected function httpPut($path, array $parameters = [], array $requestHeaders = []) |
|
| 179 | { |
|
| 180 | try { |
|
| 181 | $response = $this->httpClient->sendRequest( |
|
| 182 | $this->requestBuilder->create('PUT', $path, $requestHeaders, $this->createRequestBody($parameters)) |
|
| 183 | ); |
|
| 184 | } catch (HttplugException\NetworkException $e) { |
|
| 185 | throw HttpServerException::networkError($e); |
|
| 186 | } |
|
| 187 | ||
| 188 | return $response; |
|
| 189 | } |
|
| 190 | ||
| 191 | /** |
|
| 192 | * Send a DELETE request. |
|
| @@ 200-211 (lines=12) @@ | ||
| 197 | * |
|
| 198 | * @return ResponseInterface |
|
| 199 | */ |
|
| 200 | protected function httpDelete($path, array $parameters = [], array $requestHeaders = []) |
|
| 201 | { |
|
| 202 | try { |
|
| 203 | $response = $this->httpClient->sendRequest( |
|
| 204 | $this->requestBuilder->create('DELETE', $path, $requestHeaders, $this->createRequestBody($parameters)) |
|
| 205 | ); |
|
| 206 | } catch (HttplugException\NetworkException $e) { |
|
| 207 | throw HttpServerException::networkError($e); |
|
| 208 | } |
|
| 209 | ||
| 210 | return $response; |
|
| 211 | } |
|
| 212 | ||
| 213 | /** |
|
| 214 | * Prepare a set of key-value-pairs to be encoded as multipart/form-data. |
|