Skip to content
This repository
Browse code

use constant in both places and give it a better name

  • Loading branch information...
commit 695c686f0193f3fba587cff96fa1cace4c765f32 1 parent 53f99c1
Robert Newson authored
4 src/main/java/com/github/rnewson/couchdb/lucene/couchdb/HttpUtils.java
@@ -47,7 +47,7 @@ public static final String get(final HttpClient httpClient, final String url) th
47 47
48 48 public static final String post(final HttpClient httpClient, final String url, final JSONObject body) throws IOException {
49 49 final HttpPost post = new HttpPost(url);
50   - post.setHeader("Content-Type", "application/json");
  50 + post.setHeader("Content-Type", Constants.APPLICATION_JSON);
51 51 post.setEntity(new StringEntity(body.toString(), "UTF-8"));
52 52 return execute(httpClient, post);
53 53 }
@@ -55,7 +55,7 @@ public static final String post(final HttpClient httpClient, final String url, f
55 55 public static final int put(final HttpClient httpClient, final String url, final String body) throws IOException {
56 56 final HttpPut put = new HttpPut(url);
57 57 if (body != null) {
58   - put.setHeader("Content-Type", Constants.CONTENT_TYPE);
  58 + put.setHeader("Content-Type", Constants.APPLICATION_JSON);
59 59 put.setEntity(new StringEntity(body, "UTF-8"));
60 60 }
61 61 return httpClient.execute(put, new StatusCodeResponseHandler());
2  src/main/java/com/github/rnewson/couchdb/lucene/util/Constants.java
@@ -26,7 +26,7 @@
26 26
27 27 public static final Analyzer ANALYZER = new StandardAnalyzer(VERSION);
28 28
29   - public static final String CONTENT_TYPE = "application/json";
  29 + public static final String APPLICATION_JSON = "application/json";
30 30
31 31 public static final String DEFAULT_FIELD = "default";
32 32

0 comments on commit 695c686

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