Skip to content

Commit 81d8479

Browse files
committed
fix(android): broken headers in response
1 parent 8476b08 commit 81d8479

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

plugin/platforms/android/java/com/nativescript/https/OkHttpResponse.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,18 @@ public void run() {
457457
public static int getStatusCode(Response response) {
458458
return response.code();
459459
}
460+
460461
public static String getMessage(Response response) {
461462
return response.message();
462463
}
464+
465+
public static String getHeaders(Response response) throws Exception {
466+
JSONObject obj = new JSONObject();
467+
Headers headers = response.headers();
468+
for (int i = 0; i < headers.size(); i++)
469+
{
470+
obj.put(headers.name(i), headers.value(i));
471+
}
472+
return obj.toString();
473+
}
463474
}

0 commit comments

Comments
 (0)