Skip to content
Browse files

use constant in both places and give it a better name

  • Loading branch information...
1 parent 53f99c1 commit 695c686f0193f3fba587cff96fa1cace4c765f32 Robert Newson committed May 28, 2011
View
4 src/main/java/com/github/rnewson/couchdb/lucene/couchdb/HttpUtils.java
@@ -47,15 +47,15 @@ public static final String get(final HttpClient httpClient, final String url) th
public static final String post(final HttpClient httpClient, final String url, final JSONObject body) throws IOException {
final HttpPost post = new HttpPost(url);
- post.setHeader("Content-Type", "application/json");
+ post.setHeader("Content-Type", Constants.APPLICATION_JSON);
post.setEntity(new StringEntity(body.toString(), "UTF-8"));
return execute(httpClient, post);
}
public static final int put(final HttpClient httpClient, final String url, final String body) throws IOException {
final HttpPut put = new HttpPut(url);
if (body != null) {
- put.setHeader("Content-Type", Constants.CONTENT_TYPE);
+ put.setHeader("Content-Type", Constants.APPLICATION_JSON);
put.setEntity(new StringEntity(body, "UTF-8"));
}
return httpClient.execute(put, new StatusCodeResponseHandler());
View
2 src/main/java/com/github/rnewson/couchdb/lucene/util/Constants.java
@@ -26,7 +26,7 @@
public static final Analyzer ANALYZER = new StandardAnalyzer(VERSION);
- public static final String CONTENT_TYPE = "application/json";
+ public static final String APPLICATION_JSON = "application/json";
public static final String DEFAULT_FIELD = "default";

0 comments on commit 695c686

Please sign in to comment.
Something went wrong with that request. Please try again.