diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-02-06 13:36:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-06 13:36:08 +0800 |
commit | 23660ca2426b670abf6b0899fe796d4012a81589 (patch) | |
tree | 747da02a662734846c2db2e4348ec7d7d46972d5 | |
parent | 1909b845a8c77a2463c0ad8d4c1952b8c0852ae2 (diff) | |
parent | c1968fe735816d7cb4f54a2c1a0f92f600e4d7b8 (diff) | |
download | traccar-server-23660ca2426b670abf6b0899fe796d4012a81589.tar.gz traccar-server-23660ca2426b670abf6b0899fe796d4012a81589.tar.bz2 traccar-server-23660ca2426b670abf6b0899fe796d4012a81589.zip |
Merge pull request #2874 from Abyss777/forward_header
Event forward header small improvement
-rw-r--r-- | src/org/traccar/notification/EventForwarder.java | 7 |
1 files changed, 2 insertions, 5 deletions
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()); } } } |