From 7409e56fc2cc3c8927153c63959a23d867466967 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Mon, 26 May 2008 11:51:44 +0000 Subject: Fixes to the XHR/Javascript code to be compatible with HTTP/1.0 proxies. Closes COUCHDB-40. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@660170 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/couch.js | 2 +- share/www/script/jquery.couch.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'share') diff --git a/share/www/script/couch.js b/share/www/script/couch.js index d1cff6c1..847467d4 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -218,6 +218,6 @@ CouchDB.request = function(method, uri, options) { req.setRequestHeader(headerName, headers[headerName]); } } - req.send(options.body || null); + req.send(options.body || ""); return req; } diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index 11ae4340..5dfb6025 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -40,7 +40,9 @@ compact: function(options) { options = options || {}; $.ajax({ - type: "POST", url: this.uri + "_compact", dataType: "json", + type: "POST", url: this.uri + "_compact", + contentType: "application/json", + dataType: "json", data: "", processData: false, complete: function(req) { var resp = $.httpData(req, "json"); if (req.status == 202) { @@ -56,7 +58,8 @@ create: function(options) { options = options || {}; $.ajax({ - type: "PUT", url: this.uri, dataType: "json", + type: "PUT", url: this.uri, contentType: "application/json", + dataType: "json", data: "", processData: false, complete: function(req) { var resp = $.httpData(req, "json"); if (req.status == 201) { @@ -149,8 +152,8 @@ } $.ajax({ type: method, url: uri + encodeOptions(options), - dataType: "json", data: toJSON(doc), contentType: "application/json", + dataType: "json", data: toJSON(doc), complete: function(req) { var resp = $.httpData(req, "json") doc._id = resp.id; -- cgit v1.2.3