mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: Fix exception if http request has no headers
This commit is contained in:
+6
-4
@@ -41,11 +41,13 @@ public class GarminHttpRequest {
|
||||
this.webRequest = webRequest;
|
||||
this.method = webRequest.getMethod().name();
|
||||
this.uri = Uri.parse(webRequest.getUrl());
|
||||
final JsonElement garminHeaders = GarminJson.decode(webRequest.getHeaders().toByteArray());
|
||||
this.headers = new LinkedHashMap<>();
|
||||
if (garminHeaders instanceof JsonObject jsonObject) {
|
||||
for (String key : jsonObject.keySet()) {
|
||||
headers.put(key, jsonObject.get(key).getAsString());
|
||||
if (!webRequest.getHeaders().isEmpty()) {
|
||||
final JsonElement garminHeaders = GarminJson.decode(webRequest.getHeaders().toByteArray());
|
||||
if (garminHeaders instanceof JsonObject jsonObject) {
|
||||
for (String key : jsonObject.keySet()) {
|
||||
headers.put(key, jsonObject.get(key).getAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user