Skip to content

Instantly share code, notes, and snippets.

@djmaze
Created July 29, 2009 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djmaze/158055 to your computer and use it in GitHub Desktop.
Save djmaze/158055 to your computer and use it in GitHub Desktop.
diff --git a/src/main/java/com/github/rnewson/couchdb/lucene/SearchRequest.java b/src/main/java/com/github/rnewson/couchdb/lucene/SearchRequest.java
index 12abf8a..a5d5966 100644
--- a/src/main/java/com/github/rnewson/couchdb/lucene/SearchRequest.java
+++ b/src/main/java/com/github/rnewson/couchdb/lucene/SearchRequest.java
@@ -254,11 +254,11 @@ public final class SearchRequest {
if (debug) {
headers.put("Content-Type", "text/plain;charset=utf-8");
result.put("body", escape(json.toString(2)));
+ } else if (callback != null) {
+ headers.put("Content-Type", "text/plain;charset=utf-8");
+ result.put("body", String.format("%s(%s)", callback, json.toString()));
} else {
- if (callback != null)
- result.put("json", String.format("%s(%s)", callback, json));
- else
- result.put("json", json);
+ result.put("json", json);
}
// Include headers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment