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