Skip to content

Commit 7a58bf9

Browse files
author
Mark
committed
vpack http header
1 parent f1f2c8f commit 7a58bf9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/com/arangodb/http/HttpManager.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.http.HeaderElement;
3030
import org.apache.http.HeaderElementIterator;
3131
import org.apache.http.HttpEntity;
32+
import org.apache.http.HttpHeaders;
3233
import org.apache.http.HttpHost;
3334
import org.apache.http.HttpResponse;
3435
import org.apache.http.HttpStatus;
@@ -410,8 +411,9 @@ private HttpResponseEntity executeInternal(final String baseUrl, final HttpReque
410411
final HttpRequestBase request = buildHttpRequestBase(requestEntity, url);
411412

412413
// 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());
415417

416418
addOptionalHeaders(requestEntity, request);
417419

@@ -511,7 +513,8 @@ private HttpResponseEntity buildHttpResponseEntity(
511513
}
512514
// Close stream in this method.
513515
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);
515518
responseEntity.setContent(content);
516519
// responseEntity.setText(IOUtils.toString(entity.getContent()));
517520
if (logger.isDebugEnabled()) {

0 commit comments

Comments
 (0)