|
@@ 63-72 (lines=10) @@
|
| 60 |
|
* |
| 61 |
|
* @return ResponseInterface |
| 62 |
|
*/ |
| 63 |
|
protected function httpGet(string $path, array $params = [], array $requestHeaders = []): ResponseInterface |
| 64 |
|
{ |
| 65 |
|
if (count($params) > 0) { |
| 66 |
|
$path .= '?'.http_build_query($params); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
return $this->httpClient->sendRequest( |
| 70 |
|
$this->requestBuilder->create('GET', $path, $requestHeaders) |
| 71 |
|
); |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
/** |
| 75 |
|
* Send a POST request with JSON-encoded parameters. |
|
@@ 115-122 (lines=8) @@
|
| 112 |
|
* |
| 113 |
|
* @return ResponseInterface |
| 114 |
|
*/ |
| 115 |
|
protected function httpPut(string $path, array $params = [], array $requestHeaders = []): ResponseInterface |
| 116 |
|
{ |
| 117 |
|
$requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 118 |
|
|
| 119 |
|
return $this->httpClient->sendRequest( |
| 120 |
|
$this->requestBuilder->create('PUT', $path, $requestHeaders, http_build_query($params)) |
| 121 |
|
); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
/** |
| 125 |
|
* Send a PATCH request with JSON-encoded parameters. |
|
@@ 133-140 (lines=8) @@
|
| 130 |
|
* |
| 131 |
|
* @return ResponseInterface |
| 132 |
|
*/ |
| 133 |
|
protected function httpPatch(string $path, array $params = [], array $requestHeaders = []): ResponseInterface |
| 134 |
|
{ |
| 135 |
|
$requestHeaders['Content-Type'] = 'application/json'; |
| 136 |
|
|
| 137 |
|
return $this->httpClient->sendRequest( |
| 138 |
|
$this->requestBuilder->create('PATCH', $path, $requestHeaders, json_encode($params)) |
| 139 |
|
); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* Send a DELETE request with JSON-encoded parameters. |
|
@@ 151-158 (lines=8) @@
|
| 148 |
|
* |
| 149 |
|
* @return ResponseInterface |
| 150 |
|
*/ |
| 151 |
|
protected function httpDelete(string $path, array $params = [], array $requestHeaders = []): ResponseInterface |
| 152 |
|
{ |
| 153 |
|
$requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
| 154 |
|
|
| 155 |
|
return $this->httpClient->sendRequest( |
| 156 |
|
$this->requestBuilder->create('DELETE', $path, $requestHeaders, http_build_query($params)) |
| 157 |
|
); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
/** |
| 161 |
|
* Handle HTTP errors. |