javeme commented on code in PR #133:
URL:
https://github.com/apache/incubator-hugegraph-commons/pull/133#discussion_r1382557711
##########
hugegraph-common/src/main/java/org/apache/hugegraph/rest/RestResult.java:
##########
@@ -21,39 +21,47 @@
import java.util.ArrayList;
import java.util.List;
-import jakarta.ws.rs.core.MultivaluedMap;
-import jakarta.ws.rs.core.Response;
-
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.SneakyThrows;
+import okhttp3.Response;
+
public class RestResult {
private static final ObjectMapper MAPPER = new ObjectMapper();
private final int status;
- private final MultivaluedMap<String, Object> headers;
+ private final RestHeaders headers;
private final String content;
public RestResult(Response response) {
- this(response.getStatus(), response.readEntity(String.class),
- response.getHeaders());
+ this(response.code(), getResponseContent(response),
+ RestHeaders.convertToRestHeaders(response.headers()));
}
- public RestResult(int status, String content,
- MultivaluedMap<String, Object> headers) {
+ public RestResult(int status, String content, RestHeaders headers) {
this.status = status;
this.headers = headers;
this.content = content;
}
+ @SneakyThrows
+ private static String getResponseContent(Response response) {
Review Comment:
we can delete this one-line-code method if it's only called by one place
--
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]