diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2012-04-17 14:00:25 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2012-04-17 14:00:25 +0200 |
commit | 73dda01c7f71b5930d9ca6f2d8785d9c33095d96 (patch) | |
tree | 28847b4685e922b119b73ec0c11e77e1c8fc433b /main/src/cgeo/geocaching/network | |
parent | aada2fe039a8467a00f9c4eab917068e4d0b97a8 (diff) | |
download | cgeo-73dda01c7f71b5930d9ca6f2d8785d9c33095d96.zip cgeo-73dda01c7f71b5930d9ca6f2d8785d9c33095d96.tar.gz cgeo-73dda01c7f71b5930d9ca6f2d8785d9c33095d96.tar.bz2 |
Refactoring: put the header into a common place
Diffstat (limited to 'main/src/cgeo/geocaching/network')
-rw-r--r-- | main/src/cgeo/geocaching/network/Network.java | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/network/Network.java b/main/src/cgeo/geocaching/network/Network.java index 5bb8f2a..bcfa626 100644 --- a/main/src/cgeo/geocaching/network/Network.java +++ b/main/src/cgeo/geocaching/network/Network.java @@ -175,7 +175,6 @@ public abstract class Network { if (params != null) { request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); } - request.setHeader("X-Requested-With", "XMLHttpRequest"); return Network.request(request); } catch (final Exception e) { // Can be UnsupportedEncodingException, ClientProtocolException or IOException @@ -199,7 +198,6 @@ public abstract class Network { final String fullUri = params == null ? uri : Uri.parse(uri).buildUpon().encodedQuery(params.toString()).build().toString(); final HttpRequestBase request = new HttpGet(fullUri); - request.setHeader("X-Requested-With", "XMLHttpRequest"); if (headers != null) { for (final NameValuePair header : headers) { request.setHeader(header.getName(), header.getValue()); @@ -263,6 +261,7 @@ public abstract class Network { public static HttpResponse request(final HttpRequestBase request) { request.setHeader("Accept-Charset", "utf-8,iso-8859-1;q=0.8,utf-16;q=0.8,*;q=0.7"); request.setHeader("Accept-Language", "en-US,*;q=0.9"); + request.setHeader("X-Requested-With", "XMLHttpRequest"); request.getParams().setParameter(CoreProtocolPNames.USER_AGENT, USER_AGENT); final String reqLogStr = request.getMethod() + " " + Network.hidePassword(request.getURI().toString()); |