MCPcopy Create free account
hub / github.com/apache/impala / post

Method post

fe/src/test/java/org/apache/impala/testutil/WebClient.java:147–165  ·  view source on GitHub ↗

Does a POST request at path of the Impala web server and returns response. If the response does not include the expected status code, returns null. @param path URI path to query @param headers Headers to include in the POST; can be null @param params Parameters to include in the POST; can be null @p

(String path, Header[] headers, List<NameValuePair> params, int code)

Source from the content-addressed store, hash-verified

145 * @throws IOException if the request fails
146 */
147 public String post(String path, Header[] headers, List<NameValuePair> params, int code)
148 throws IOException {
149 HttpHost target = new HttpHost(WEBSERVER_HOST, port_, "http");
150 HttpClientContext context = getContext(target);
151
152 HttpPost post = new HttpPost(path);
153 if (headers != null) {
154 post.setHeaders(headers);
155 }
156 if (params != null) {
157 post.setEntity(new UrlEncodedFormEntity(params));
158 }
159 try (CloseableHttpResponse response = httpClient_.execute(target, post, context)) {
160 if (response.getStatusLine().getStatusCode() != code) {
161 return null;
162 }
163 return EntityUtils.toString(response.getEntity());
164 }
165 }
166
167 private HttpClientContext getContext(HttpHost targetHost) {
168 HttpClientContext context = HttpClientContext.create();

Callers 14

jsonPostMethod · 0.95
createRangerPolicyMethod · 0.80
testSetGLogLevelMethod · 0.80
testSetJavaLogLevelMethod · 0.80
_add_ranger_userMethod · 0.80
_add_deny_policyMethod · 0.80
post_dataFunction · 0.80
cancelFunction · 0.80

Calls 3

getContextMethod · 0.95
executeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected