|
29 | 29 | import org.apache.http.HeaderElement;
|
30 | 30 | import org.apache.http.HeaderElementIterator;
|
31 | 31 | import org.apache.http.HttpEntity;
|
| 32 | +import org.apache.http.HttpHeaders; |
32 | 33 | import org.apache.http.HttpHost;
|
33 | 34 | import org.apache.http.HttpResponse;
|
34 | 35 | import org.apache.http.HttpStatus;
|
@@ -410,8 +411,9 @@ private HttpResponseEntity executeInternal(final String baseUrl, final HttpReque
|
410 | 411 | final HttpRequestBase request = buildHttpRequestBase(requestEntity, url);
|
411 | 412 |
|
412 | 413 | // common-header
|
413 |
| - request.setHeader("User-Agent", USERAGENT); |
414 |
| - request.setHeader("Accept", CONTENT_TYPE.getMimeType()); |
| 414 | + request.setHeader(HttpHeaders.USER_AGENT, USERAGENT); |
| 415 | + request.setHeader(HttpHeaders.CONTENT_TYPE, CONTENT_TYPE.getMimeType()); |
| 416 | + request.setHeader(HttpHeaders.ACCEPT, CONTENT_TYPE.getMimeType()); |
415 | 417 |
|
416 | 418 | addOptionalHeaders(requestEntity, request);
|
417 | 419 |
|
@@ -511,7 +513,8 @@ private HttpResponseEntity buildHttpResponseEntity(
|
511 | 513 | }
|
512 | 514 | // Close stream in this method.
|
513 | 515 | if (responseEntity.getStream() == null) {
|
514 |
| - final VPackSlice content = new VPackSlice(IOUtils.toByteArray(entity.getContent())); |
| 516 | + final byte[] byteArray = IOUtils.toByteArray(entity.getContent()); |
| 517 | + final VPackSlice content = new VPackSlice(byteArray); |
515 | 518 | responseEntity.setContent(content);
|
516 | 519 | // responseEntity.setText(IOUtils.toString(entity.getContent()));
|
517 | 520 | if (logger.isDebugEnabled()) {
|
|
0 commit comments