zhenyuT commented on code in PR #133:
URL: 
https://github.com/apache/incubator-hugegraph-commons/pull/133#discussion_r1374719015


##########
hugegraph-common/src/main/java/org/apache/hugegraph/rest/AbstractRestClient.java:
##########
@@ -207,31 +265,64 @@ public RestResult post(String path, Object object) {
     }
 
     @Override
-    public RestResult post(String path, Object object,
-                           MultivaluedMap<String, Object> headers) {
+    public RestResult post(String path, Object object, RestHeaders headers) {
         return this.post(path, object, headers, null);
     }
 
     @Override
-    public RestResult post(String path, Object object,
-                           Map<String, Object> params) {
+    public RestResult post(String path, Object object, Map<String, Object> 
params) {
         return this.post(path, object, null, params);
     }
 
+    private Request.Builder getRequestBuilder(String path, String id, 
RestHeaders headers,
+                                              Map<String, Object> params) {
+        HttpUrl.Builder urlBuilder = HttpUrl.parse(baseUrl).newBuilder()
+                                            .addPathSegments(path);
+        if (id != null) {
+            urlBuilder.addPathSegment(id);
+        }
+
+        if (params != null) {
+            params.forEach((name, value) -> {
+                if (value == null) {
+                    return;
+                }
+
+                if (value instanceof Collection) {
+                    for (Object i : (Collection<?>) value) {
+                        urlBuilder.addQueryParameter(name, String.valueOf(i));
+                    }
+                } else {
+                    urlBuilder.addQueryParameter(name, String.valueOf(value));
+                }
+            });
+        }
+
+        Request.Builder builder = requestBuilder
+                .url(urlBuilder.build());
+
+        if (headers != null) {
+            builder.headers(headers.toOkhttpHeader());
+        }
+
+        this.attachAuthToRequest(builder);
+
+        return builder;
+    }
+
+    @SneakyThrows
     @Override
     public RestResult post(String path, Object object,
-                           MultivaluedMap<String, Object> headers,
+                           RestHeaders headers,

Review Comment:
   not understand



-- 
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: dev-unsubscr...@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to