Permalink
Browse files

fix JSONP callback parameter, thanks djmaze.

  • Loading branch information...
Robert Newson
Robert Newson committed Jul 29, 2009
1 parent 66b4de1 commit 20af671a52c0089711f0411e2e607f422b78d204
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/main/java/com/github/rnewson/couchdb/lucene/SearchRequest.java
@@ -247,19 +247,20 @@ 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);
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);

0 comments on commit 20af671

Please sign in to comment.