@@ 78-87 (lines=10) @@ | ||
75 | * |
|
76 | * @return ResponseInterface |
|
77 | */ |
|
78 | protected function httpGet($path, array $params = [], array $requestHeaders = []) |
|
79 | { |
|
80 | if (count($params) > 0) { |
|
81 | $path .= '?'.http_build_query($params); |
|
82 | } |
|
83 | ||
84 | return $this->httpClient->sendRequest( |
|
85 | $this->requestFactory->createRequest('GET', $path, $requestHeaders) |
|
86 | ); |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * Send a POST request with JSON-encoded parameters. |
|
@@ 130-137 (lines=8) @@ | ||
127 | * |
|
128 | * @return ResponseInterface |
|
129 | */ |
|
130 | protected function httpPut($path, array $params = [], array $requestHeaders = []) |
|
131 | { |
|
132 | $requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
|
133 | ||
134 | return $this->httpClient->sendRequest( |
|
135 | $this->requestFactory->createRequest('PUT', $path, $requestHeaders, http_build_query($params)) |
|
136 | ); |
|
137 | } |
|
138 | ||
139 | /** |
|
140 | * Send a DELETE request with JSON-encoded parameters. |
|
@@ 148-155 (lines=8) @@ | ||
145 | * |
|
146 | * @return ResponseInterface |
|
147 | */ |
|
148 | protected function httpDelete($path, array $params = [], array $requestHeaders = []) |
|
149 | { |
|
150 | $requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; |
|
151 | ||
152 | return $this->httpClient->sendRequest( |
|
153 | $this->requestFactory->createRequest('DELETE', $path, $requestHeaders, http_build_query($params)) |
|
154 | ); |
|
155 | } |
|
156 | ||
157 | /** |
|
158 | * Handle HTTP errors. |