aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-02-06 10:18:15 +0500
committerAbyss777 <abyss@fox5.ru>2017-02-06 10:18:15 +0500
commitc1968fe735816d7cb4f54a2c1a0f92f600e4d7b8 (patch)
tree747da02a662734846c2db2e4348ec7d7d46972d5 /src
parent1909b845a8c77a2463c0ad8d4c1952b8c0852ae2 (diff)
downloadtraccar-server-c1968fe735816d7cb4f54a2c1a0f92f600e4d7b8.tar.gz
traccar-server-c1968fe735816d7cb4f54a2c1a0f92f600e4d7b8.tar.bz2
traccar-server-c1968fe735816d7cb4f54a2c1a0f92f600e4d7b8.zip
Event forward header small improvement
Diffstat (limited to 'src')
-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());
}
}
}