Permalink
Browse files

send Content-Type header when requesting include_docs=true

  • Loading branch information...
1 parent 80b3ef9 commit 6f81165a786e1b1130e3683fa334f3e9ce5611ab Robert Newson committed Dec 7, 2010
@@ -89,7 +89,7 @@ public DesignDocument getDesignDocument(final String id) throws IOException, JSO
req.put("keys", keys);
final String body = HttpUtils.post(httpClient, url
- + "_all_docs?include_docs=true", req.toString());
+ + "_all_docs?include_docs=true", req);
return toDocuments(new JSONObject(body));
}
@@ -25,6 +25,7 @@
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
+import org.json.JSONObject;
import com.github.rnewson.couchdb.lucene.util.Constants;
import com.github.rnewson.couchdb.lucene.util.ErrorPreservingResponseHandler;
@@ -44,9 +45,10 @@ public static final String get(final HttpClient httpClient, final String url) th
return execute(httpClient, new HttpGet(url));
}
- public static final String post(final HttpClient httpClient, final String url, final String body) throws IOException {
+ public static final String post(final HttpClient httpClient, final String url, final JSONObject body) throws IOException {
final HttpPost post = new HttpPost(url);
- post.setEntity(new StringEntity(body));
+ post.setHeader("Content-Type", "application/json");
+ post.setEntity(new StringEntity(body.toString()));
return execute(httpClient, post);
}

0 comments on commit 6f81165

Please sign in to comment.