2727import com .arangodb .internal .net .HostDescription ;
2828import com .arangodb .internal .util .IOUtils ;
2929import com .arangodb .internal .util .ResponseUtils ;
30+ import com .arangodb .serde .DataType ;
3031import com .arangodb .util .ArangoSerialization ;
3132import com .arangodb .util .ArangoSerializer .Options ;
3233import com .arangodb .velocypack .VPackSlice ;
@@ -173,6 +174,7 @@ public HttpConnection build() {
173174 private final ArangoSerialization util ;
174175 private final Boolean useSsl ;
175176 private final Protocol contentType ;
177+ private final DataType dataType ;
176178 private final HostDescription host ;
177179
178180 private HttpConnection (final HostDescription host , final Integer timeout , final String user , final String password ,
@@ -185,6 +187,7 @@ private HttpConnection(final HostDescription host, final Integer timeout, final
185187 this .useSsl = useSsl ;
186188 this .util = util ;
187189 this .contentType = contentType ;
190+ dataType = contentType == Protocol .HTTP_JSON ? DataType .JSON : DataType .VPACK ;
188191 final RegistryBuilder <ConnectionSocketFactory > registryBuilder = RegistryBuilder
189192 .create ();
190193 if (Boolean .TRUE == useSsl ) {
@@ -355,7 +358,7 @@ private static void addHeader(final Request request, final HttpRequestBase httpR
355358
356359 public Response buildResponse (final CloseableHttpResponse httpResponse )
357360 throws UnsupportedOperationException , IOException {
358- final Response response = new Response ();
361+ final Response response = new Response (dataType );
359362 response .setResponseCode (httpResponse .getStatusLine ().getStatusCode ());
360363 final HttpEntity entity = httpResponse .getEntity ();
361364 if (entity != null && entity .getContent () != null ) {
0 commit comments