From c1968fe735816d7cb4f54a2c1a0f92f600e4d7b8 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 6 Feb 2017 10:18:15 +0500 Subject: Event forward header small improvement --- src/org/traccar/notification/EventForwarder.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/notification/EventForwarder.java b/src/org/traccar/notification/EventForwarder.java index b39a9155f..bd7cfc0c5 100644 --- a/src/org/traccar/notification/EventForwarder.java +++ b/src/org/traccar/notification/EventForwarder.java @@ -38,8 +38,6 @@ public final class EventForwarder { header = Context.getConfig().getString("event.forward.header", ""); } - private static final String USER_AGENT = "Traccar Server"; - private static final String KEY_POSITION = "position"; private static final String KEY_EVENT = "event"; private static final String KEY_GEOFENCE = "geofence"; @@ -49,14 +47,13 @@ public final class EventForwarder { BoundRequestBuilder requestBuilder = Context.getAsyncHttpClient().preparePost(url); - requestBuilder.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); - requestBuilder.addHeader("User-Agent", USER_AGENT); + requestBuilder.addHeader("Content-Type", "application/json; charset=utf-8"); if (!header.equals("")) { String[] headerLines = header.split("\\r?\\n"); for (String headerLine: headerLines) { String[] splitedLine = headerLine.split(":", 2); if (splitedLine.length == 2) { - requestBuilder.addHeader(splitedLine[0].trim(), splitedLine[1].trim()); + requestBuilder.setHeader(splitedLine[0].trim(), splitedLine[1].trim()); } } } -- cgit v1.2.3