diff options
author | Jan Lehnardt <jan@apache.org> | 2009-07-21 09:18:07 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2009-07-21 09:18:07 +0000 |
commit | 51b496b3e25c03323ce296fcb4a2a932c9b77f4b (patch) | |
tree | 1c5de2fe66114dea20fd66745b19fa70ee813fc4 /share/www/script | |
parent | 65491b2704a2e3894e4803689313e2d90174bc47 (diff) |
Close jsonp response for _changes requests. Patch by Benoit Chesneau. Closes COUCHDB-418.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@796207 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/test/changes.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js index f5a3e149..d805d6cd 100644 --- a/share/www/script/test/changes.js +++ b/share/www/script/test/changes.js @@ -10,6 +10,12 @@ // License for the specific language governing permissions and limitations under // the License. +function jsonp(obj) { + T(jsonp_flag == 0); + T(obj.results.length == 1 && obj.last_seq==1) + jsonp_flag = 1; +} + couchTests.changes = function(debug) { var db = new CouchDB("test_suite_db"); db.deleteDb(); @@ -30,6 +36,13 @@ couchTests.changes = function(debug) { T(resp.results.length == 1 && resp.last_seq==1) T(resp.results[0].changes[0].rev == docFoo._rev) + // test with callback + var xhr = CouchDB.request("GET", "/test_suite_db/_changes?callback=jsonp"); + T(xhr.status == 200); + jsonp_flag = 0; + eval(xhr.responseText); + T(jsonp_flag == 1); + req = CouchDB.request("GET", "/test_suite_db/_changes?continuous=true&timeout=10"); var resp = JSON.parse(req.responseText); |