@@ 150-161 (lines=12) @@ | ||
147 | * @param array|string $body Request body |
|
148 | * @param array $requestHeaders Request headers |
|
149 | */ |
|
150 | protected function httpPostRaw(string $path, $body, array $requestHeaders = []): ResponseInterface |
|
151 | { |
|
152 | try { |
|
153 | $response = $this->httpClient->sendRequest( |
|
154 | $this->requestBuilder->create('POST', $path, $requestHeaders, $body) |
|
155 | ); |
|
156 | } catch (Psr18\NetworkExceptionInterface $e) { |
|
157 | throw HttpServerException::networkError($e); |
|
158 | } |
|
159 | ||
160 | return $response; |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * Send a PUT request. |
|
@@ 170-181 (lines=12) @@ | ||
167 | * @param array $parameters PUT parameters |
|
168 | * @param array $requestHeaders Request headers |
|
169 | */ |
|
170 | protected function httpPut(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface |
|
171 | { |
|
172 | try { |
|
173 | $response = $this->httpClient->sendRequest( |
|
174 | $this->requestBuilder->create('PUT', $path, $requestHeaders, $this->createRequestBody($parameters)) |
|
175 | ); |
|
176 | } catch (Psr18\NetworkExceptionInterface $e) { |
|
177 | throw HttpServerException::networkError($e); |
|
178 | } |
|
179 | ||
180 | return $response; |
|
181 | } |
|
182 | ||
183 | /** |
|
184 | * Send a DELETE request. |
|
@@ 190-201 (lines=12) @@ | ||
187 | * @param array $parameters DELETE parameters |
|
188 | * @param array $requestHeaders Request headers |
|
189 | */ |
|
190 | protected function httpDelete(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface |
|
191 | { |
|
192 | try { |
|
193 | $response = $this->httpClient->sendRequest( |
|
194 | $this->requestBuilder->create('DELETE', $path, $requestHeaders, $this->createRequestBody($parameters)) |
|
195 | ); |
|
196 | } catch (Psr18\NetworkExceptionInterface $e) { |
|
197 | throw HttpServerException::networkError($e); |
|
198 | } |
|
199 | ||
200 | return $response; |
|
201 | } |
|
202 | ||
203 | /** |
|
204 | * Prepare a set of key-value-pairs to be encoded as multipart/form-data. |