aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-06 13:36:08 +0800
committerGitHub <noreply@github.com>2017-02-06 13:36:08 +0800
commit23660ca2426b670abf6b0899fe796d4012a81589 (patch)
tree747da02a662734846c2db2e4348ec7d7d46972d5 /src/org/traccar
parent1909b845a8c77a2463c0ad8d4c1952b8c0852ae2 (diff)
parentc1968fe735816d7cb4f54a2c1a0f92f600e4d7b8 (diff)
downloadtrackermap-server-23660ca2426b670abf6b0899fe796d4012a81589.tar.gz
trackermap-server-23660ca2426b670abf6b0899fe796d4012a81589.tar.bz2
trackermap-server-23660ca2426b670abf6b0899fe796d4012a81589.zip
Merge pull request #2874 from Abyss777/forward_header
Event forward header small improvement
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/notification/EventForwarder.java7
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());
}
}
}