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