From 3bbbbf14522cbd95f2a0f6610b8b6af5ebb6c778 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Mon, 26 May 2008 12:47:00 +0000 Subject: * Respond to DELETE requests with a "200 OK" status code instead of "202 Accepted", as the deletion is performed immediately. * The "content-type" member in attachment structures is now named "content_type" (underscore) for consistency and to be more accessible from Javascript (and presumably other languages, too) git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@660176 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/browse.js | 2 +- share/www/script/couch.js | 4 ++-- share/www/script/couch_tests.js | 16 ++++++++-------- share/www/script/jquery.couch.js | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'share') diff --git a/share/www/script/browse.js b/share/www/script/browse.js index 4491246b..ec514f09 100644 --- a/share/www/script/browse.js +++ b/share/www/script/browse.js @@ -791,7 +791,7 @@ function CouchDocumentPage() { .attr("href", db.uri + encodeURIComponent(docId) + "/" + encodeURIComponent(name)) .wrapInner("").appendTo(li); $("()").text("" + prettyPrintSize(attachment.length) + - ", " + attachment["content-type"]).addClass("info").appendTo(li); + ", " + attachment.content_type).addClass("info").appendTo(li); _initAttachmentItem(name, attachment, li); return li; } diff --git a/share/www/script/couch.js b/share/www/script/couch.js index 847467d4..947a5137 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -33,7 +33,7 @@ function CouchDB(name) { if (req.status == 404) return false; var result = JSON.parse(req.responseText); - if (req.status != 202) + if (req.status != 200) throw result; return result; } @@ -73,7 +73,7 @@ function CouchDB(name) { this.deleteDoc = function(doc) { var req = request("DELETE", this.uri + encodeURIComponent(doc._id) + "?rev=" + doc._rev); var result = JSON.parse(req.responseText); - if (req.status != 202) + if (req.status != 200) throw result; doc._rev = result.rev; //record rev in input document doc._deleted = true; diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index ea31e140..8693d38c 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -388,11 +388,11 @@ var tests = { if (debug) debugger; var binAttDoc = { - _id:"bin_doc", + _id: "bin_doc", _attachments:{ "foo.txt": { - "content-type":"text/plain", - "data": "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ=" + content_type:"text/plain", + data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ=" } } } @@ -401,7 +401,7 @@ var tests = { var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc/foo.txt"); T(xhr.responseText == "This is a base64 encoded text") - T(xhr.getResponseHeader("content-type") == "text/plain") + T(xhr.getResponseHeader("Content-Type") == "text/plain") }, content_negotiation: function(debug) { @@ -954,11 +954,11 @@ var tests = { var binAttDoc = { - _id:"bin_doc", + _id: "bin_doc", _attachments:{ "foo.txt": { - "content-type":"text/plain", - "data": "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ=" + content_type:"text/plain", + data: "VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVkIHRleHQ=" } } } @@ -982,7 +982,7 @@ var tests = { var xhr = CouchDB.request("GET", "/test_suite_db/bin_doc/foo.txt"); T(xhr.responseText == "This is a base64 encoded text") - T(xhr.getResponseHeader("content-type") == "text/plain") + T(xhr.getResponseHeader("Content-Type") == "text/plain") var compactedsize = db.info().disk_size; diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index 5dfb6025..1e3e623c 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -78,7 +78,7 @@ type: "DELETE", url: this.uri, dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 202) { + if (req.status == 200) { if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); @@ -176,7 +176,7 @@ dataType: "json", complete: function(req) { var resp = $.httpData(req, "json"); - if (req.status == 202) { + if (req.status == 200) { if (options.success) options.success(resp); } else if (options.error) { options.error(req.status, resp.error, resp.reason); -- cgit v1.2.3