diff options
author | Jan Lehnardt <jan@apache.org> | 2010-06-02 17:45:56 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2010-06-02 17:45:56 +0000 |
commit | baf25cefa01d305a47087686becef7de7147321a (patch) | |
tree | 4325283b8e57064be26daf421d8ded8930b36c9c /share/www/script/couch.js | |
parent | 7fe84eba9982ebb3bcaa48b7aa28fdd2e130422d (diff) |
Add tests for couch.js and jquery.couch.js
Patch by Lena Herrmann.
Closes COUCHDB-783.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@950689 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/couch.js')
-rw-r--r-- | share/www/script/couch.js | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js index c5495424..dbffa7ce 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -22,10 +22,10 @@ function CouchDB(name, httpHeaders) { this.last_req = null; this.request = function(method, uri, requestOptions) { - requestOptions = requestOptions || {} - requestOptions.headers = combine(requestOptions.headers, httpHeaders) - return CouchDB.request(method, uri, requestOptions); - } + requestOptions = requestOptions || {} + requestOptions.headers = combine(requestOptions.headers, httpHeaders) + return CouchDB.request(method, uri, requestOptions); + } // Creates the database on the server this.createDb = function() { @@ -198,12 +198,6 @@ function CouchDB(name, httpHeaders) { return JSON.parse(this.last_req.responseText); } - this.viewCleanup = function() { - this.last_req = this.request("POST", this.uri + "_view_cleanup"); - CouchDB.maybeThrowError(this.last_req); - return JSON.parse(this.last_req.responseText); - } - this.allDocs = function(options,keys) { if(!keys) { this.last_req = this.request("GET", this.uri + "_all_docs" @@ -223,18 +217,11 @@ function CouchDB(name, httpHeaders) { return this.allDocs({startkey:"_design", endkey:"_design0"}); }; - this.changes = function(options,keys) { - var req = null; - if(!keys) { - req = this.request("GET", this.uri + "_changes" + encodeOptions(options)); - } else { - req = this.request("POST", this.uri + "_changes" + encodeOptions(options), { - headers: {"Content-Type": "application/json"}, - body: JSON.stringify({keys:keys}) - }); - } - CouchDB.maybeThrowError(req); - return JSON.parse(req.responseText); + this.changes = function(options) { + this.last_req = this.request("GET", this.uri + "_changes" + + encodeOptions(options)); + CouchDB.maybeThrowError(this.last_req); + return JSON.parse(this.last_req.responseText); } this.compact = function() { |