@@ 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 DELETE request with JSON-encoded parameters. |
|
@@ 133-140 (lines=8) @@ | ||
130 | * |
|
131 | * @return ResponseInterface |
|
132 | */ |
|
133 | protected function httpDelete(string $path, array $params = [], array $requestHeaders = []): ResponseInterface |
|
134 | { |
|
135 | $requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
|
136 | ||
137 | return $this->httpClient->sendRequest( |
|
138 | $this->requestBuilder->create('DELETE', $path, $requestHeaders, http_build_query($params)) |
|
139 | ); |
|
140 | } |
|
141 | ||
142 | /** |
|
143 | * Handle HTTP errors. |