@@ 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 with JSON-encoded parameters. |
|
@@ 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->createJsonBody($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 with JSON-encoded parameters. |
|
@@ 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->createJsonBody($parameters)) |
|
203 | ); |
|
204 | } catch (HttplugException\NetworkException $e) { |
|
205 | throw HttpServerException::networkError($e); |
|
206 | } |
|
207 | ||
208 | return $response; |
|
209 | } |
|
210 | ||
211 | /** |
|
212 | * Create a JSON encoded version of an array of parameters. |