Skip to content

Commit 4957d6b

Browse files
committed
Added missing type to ObjectMapper::readValue
1 parent 7fd96da commit 4957d6b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/mashape/unirest/http/HttpResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public HttpResponse(org.apache.http.HttpResponse response, Class<T> responseClas
9797
} else if (InputStream.class.equals(responseClass)) {
9898
this.body = (T) this.rawBody;
9999
} else if (objectMapper != null) {
100-
this.body = (T) objectMapper.readValue(new String(rawBody, charset));
100+
this.body = objectMapper.readValue(new String(rawBody, charset), responseClass);
101101
} else {
102102
throw new Exception("Only String, JsonNode and InputStream are supported, or an ObjectMapper implementation is required.");
103103
}

src/main/java/com/mashape/unirest/http/ObjectMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public interface ObjectMapper {
44

5-
Object readValue(String value);
5+
<T> T readValue(String value, Class<T> valueType);
66

77
String writeValue(Object value);
88
}

0 commit comments

Comments
 (0)