openvidu-test-browsers: fix CustomHttpClient when response is null

pull/781/head
pabloFuente 2022-12-29 22:41:49 +01:00
parent 5755412566
commit 48da31f452
1 changed files with 4 additions and 1 deletions

View File

@ -251,13 +251,16 @@ public class CustomHttpClient {
private JsonObject commonRest(HttpMethod method, String path, String body, int status) throws Exception {
String stringResponse = this.commonRestString(method, path, body, status);
JsonObject json = null;
if (stringResponse == null) {
return null;
}
JsonElement jsonElement = null;
try {
jsonElement = JsonParser.parseString(stringResponse);
} catch (JsonParseException e) {
System.out.println("Response is not a JSON element: " + stringResponse);
}
JsonObject json = null;
if (jsonElement != null) {
try {
json = jsonElement.getAsJsonObject();