forked from loafle/openapi-generator-original
Adjust client response handler to be backwards compatible with older versions of Vert.x (<3.5) (#854)
This commit is contained in:
parent
d374e1c160
commit
2044c36398
@ -18,6 +18,7 @@ import io.vertx.core.file.FileSystem;
|
|||||||
import io.vertx.core.file.OpenOptions;
|
import io.vertx.core.file.OpenOptions;
|
||||||
import io.vertx.core.http.HttpHeaders;
|
import io.vertx.core.http.HttpHeaders;
|
||||||
import io.vertx.core.http.HttpMethod;
|
import io.vertx.core.http.HttpMethod;
|
||||||
|
import io.vertx.core.json.DecodeException;
|
||||||
import io.vertx.core.json.Json;
|
import io.vertx.core.json.Json;
|
||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
import io.vertx.ext.web.client.HttpRequest;
|
import io.vertx.ext.web.client.HttpRequest;
|
||||||
@ -553,7 +554,11 @@ public class ApiClient {
|
|||||||
handleFileDownload(httpResponse, handler);
|
handleFileDownload(httpResponse, handler);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
resultContent = Json.decodeValue(httpResponse.body(), returnType);
|
try {
|
||||||
|
resultContent = Json.mapper.readValue(httpResponse.bodyAsString(), returnType);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new DecodeException("Failed to decode:" + e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result = Future.succeededFuture(resultContent);
|
result = Future.succeededFuture(resultContent);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import io.vertx.core.file.FileSystem;
|
|||||||
import io.vertx.core.file.OpenOptions;
|
import io.vertx.core.file.OpenOptions;
|
||||||
import io.vertx.core.http.HttpHeaders;
|
import io.vertx.core.http.HttpHeaders;
|
||||||
import io.vertx.core.http.HttpMethod;
|
import io.vertx.core.http.HttpMethod;
|
||||||
|
import io.vertx.core.json.DecodeException;
|
||||||
import io.vertx.core.json.Json;
|
import io.vertx.core.json.Json;
|
||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
import io.vertx.ext.web.client.HttpRequest;
|
import io.vertx.ext.web.client.HttpRequest;
|
||||||
@ -554,7 +555,11 @@ public class ApiClient {
|
|||||||
handleFileDownload(httpResponse, handler);
|
handleFileDownload(httpResponse, handler);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
resultContent = Json.decodeValue(httpResponse.body(), returnType);
|
try {
|
||||||
|
resultContent = Json.mapper.readValue(httpResponse.bodyAsString(), returnType);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new DecodeException("Failed to decode:" + e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result = Future.succeededFuture(resultContent);
|
result = Future.succeededFuture(resultContent);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user