couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [31/50] jquery-couch commit: updated refs/heads/import-master to 66dbcbf
Date Tue, 01 Apr 2014 08:52:36 GMT
Only accept application/json from jquery.couch.js

Since Filipe's fix for parsing the accepted content types at r1041103, returns from
$.ajax could return a 302 that redirects to an HTML page. Functions like activeTasks()
expect JSON and barf when fed HTML.

git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1070279 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/commit/e0f9e045
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/tree/e0f9e045
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/diff/e0f9e045

Branch: refs/heads/import-master
Commit: e0f9e045ac4134791c8f3cba4dacb5e54c51de2e
Parents: 06980a2
Author: Robert Newson <rnewson@apache.org>
Authored: Sun Feb 13 19:17:22 2011 +0000
Committer: Alexander Shorin <kxepal@gmail.com>
Committed: Sun Feb 13 19:17:22 2011 +0000

----------------------------------------------------------------------
 jquery.couch.js | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/blob/e0f9e045/jquery.couch.js
----------------------------------------------------------------------
diff --git a/jquery.couch.js b/jquery.couch.js
index c9a66a9..cf0ebef 100644
--- a/jquery.couch.js
+++ b/jquery.couch.js
@@ -87,6 +87,9 @@
       options = options || {};
       $.ajax({
         type: "GET", url: this.urlPrefix + "/_session",
+        beforeSend: function(xhr) {
+            xhr.setRequestHeader('Accept', 'application/json');
+        },
         complete: function(req) {
           var resp = httpData(req, "json");
           if (req.status == 200) {
@@ -123,6 +126,9 @@
       $.ajax({
         type: "POST", url: this.urlPrefix + "/_session", dataType: "json",
         data: {name: options.name, password: options.password},
+        beforeSend: function(xhr) {
+            xhr.setRequestHeader('Accept', 'application/json');
+        },
         complete: function(req) {
           var resp = httpData(req, "json");
           if (req.status == 200) {
@@ -140,6 +146,9 @@
       $.ajax({
         type: "DELETE", url: this.urlPrefix + "/_session", dataType: "json",
         username : "_", password : "_",
+        beforeSend: function(xhr) {
+            xhr.setRequestHeader('Accept', 'application/json');
+        },
         complete: function(req) {
           var resp = httpData(req, "json");
           if (req.status == 200) {
@@ -659,6 +668,7 @@
       var commit = options.ensure_full_commit;
       delete options.ensure_full_commit;
       return function(xhr) {
+        xhr.setRequestHeader('Accept', 'application/json');
         xhr.setRequestHeader("X-Couch-Full-Commit", commit.toString());
       };
     }


Mime
View raw message