Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,15 @@ public class ApiClient {
* Deserialize response body to Java object according to the Content-Type.
*/
public <T> T deserialize(Response response, GenericType<T> returnType) throws ApiException {
// Handle file downloading.
if (returnType.equals(File.class)) {
if (response == null || returnType == null) {
return null;
}

if ("byte[]".equals(returnType.toString())) {
// Handle binary response (byte array).
return (T) response.readEntity(byte[].class);
} else if (returnType.equals(File.class)) {
// Handle file downloading.
@SuppressWarnings("unchecked")
T file = (T) downloadFileFromResponse(response);
return file;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,15 @@ public Entity<?> serialize(Object obj, Map<String, Object> formParams, String co
* Deserialize response body to Java object according to the Content-Type.
*/
public <T> T deserialize(Response response, GenericType<T> returnType) throws ApiException {
// Handle file downloading.
if (returnType.equals(File.class)) {
if (response == null || returnType == null) {
return null;
}

if ("byte[]".equals(returnType.toString())) {
// Handle binary response (byte array).
return (T) response.readEntity(byte[].class);
} else if (returnType.equals(File.class)) {
// Handle file downloading.
@SuppressWarnings("unchecked")
T file = (T) downloadFileFromResponse(response);
return file;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,15 @@ public Entity<?> serialize(Object obj, Map<String, Object> formParams, String co
* Deserialize response body to Java object according to the Content-Type.
*/
public <T> T deserialize(Response response, GenericType<T> returnType) throws ApiException {
// Handle file downloading.
if (returnType.equals(File.class)) {
if (response == null || returnType == null) {
return null;
}

if ("byte[]".equals(returnType.toString())) {
// Handle binary response (byte array).
return (T) response.readEntity(byte[].class);
} else if (returnType.equals(File.class)) {
// Handle file downloading.
@SuppressWarnings("unchecked")
T file = (T) downloadFileFromResponse(response);
return file;
Expand Down