z7658329 commented on code in PR #113:
URL: 
https://github.com/apache/incubator-hugegraph-commons/pull/113#discussion_r1011206450


##########
hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java:
##########
@@ -396,17 +398,35 @@ private Pair<Builder, Entity<?>> buildRequest(
          * because Entity.json() method will reset "content encoding =
          * null" that has been set up by headers before.
          */
+        MediaType customContentType = parseCustomContentType(headers);
         Entity<?> entity;
         if (encoding == null) {
-            entity = Entity.json(object);
+            entity = Entity.entity(object, customContentType);
         } else {
-            Variant variant = new Variant(MediaType.APPLICATION_JSON_TYPE,
+            Variant variant = new Variant(customContentType,
                                           (String) null, encoding);
             entity = Entity.entity(object, variant);
         }
         return Pair.of(builder, entity);
     }
 
+    /**
+     * parse user custom content-type, returns MediaType.APPLICATION_JSON_TYPE 
default.
+     * @param headers
+     * @return
+     */
+    public static MediaType parseCustomContentType(MultivaluedMap<String, 
Object> headers) {

Review Comment:
   i will fix this case in next PR



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to