Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix JSONP callback parameter, thanks djmaze.

  • Loading branch information...
commit 20af671a52c0089711f0411e2e607f422b78d204 1 parent 66b4de1
@rnewson authored
View
13 src/main/java/com/github/rnewson/couchdb/lucene/SearchRequest.java
@@ -247,6 +247,9 @@ public String execute(final IndexSearcher searcher) throws IOException {
result.put("code", 200);
final JSONObject headers = new JSONObject();
+ // Allow viewing in browser.
+ headers.put("Content-Type", "text/plain;charset=utf-8");
+ // Allow short-term caching.
headers.put("Cache-Control", "max-age=" + Config.COMMIT_MAX / 1000);
// Results can't change unless the IndexReader does.
headers.put("ETag", etag);
@@ -254,12 +257,10 @@ public String execute(final IndexSearcher searcher) throws IOException {
if (debug) {
headers.put("Content-Type", "text/plain;charset=utf-8");
result.put("body", escape(json.toString(2)));
- } else {
- if (callback != null)
- result.put("json", String.format("%s(%s)", callback, json));
- else
- result.put("json", json);
- }
+ } else if (callback != null)
+ result.put("body", String.format("%s(%s)", callback, json));
+ else
+ result.put("json", json);
// Include headers.
result.put("headers", headers);
Please sign in to comment.
Something went wrong with that request. Please try again.