mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-browsers: fix CustomHttpClient when response is null
parent
5755412566
commit
48da31f452
|
@ -251,13 +251,16 @@ public class CustomHttpClient {
|
||||||
|
|
||||||
private JsonObject commonRest(HttpMethod method, String path, String body, int status) throws Exception {
|
private JsonObject commonRest(HttpMethod method, String path, String body, int status) throws Exception {
|
||||||
String stringResponse = this.commonRestString(method, path, body, status);
|
String stringResponse = this.commonRestString(method, path, body, status);
|
||||||
JsonObject json = null;
|
if (stringResponse == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
JsonElement jsonElement = null;
|
JsonElement jsonElement = null;
|
||||||
try {
|
try {
|
||||||
jsonElement = JsonParser.parseString(stringResponse);
|
jsonElement = JsonParser.parseString(stringResponse);
|
||||||
} catch (JsonParseException e) {
|
} catch (JsonParseException e) {
|
||||||
System.out.println("Response is not a JSON element: " + stringResponse);
|
System.out.println("Response is not a JSON element: " + stringResponse);
|
||||||
}
|
}
|
||||||
|
JsonObject json = null;
|
||||||
if (jsonElement != null) {
|
if (jsonElement != null) {
|
||||||
try {
|
try {
|
||||||
json = jsonElement.getAsJsonObject();
|
json = jsonElement.getAsJsonObject();
|
||||||
|
|
Loading…
Reference in New Issue