CouchDB: return 200 OK on DELETE requests
26 May 2008
12:07
as Diff
| 1 | Index: src/couchdb/couch_httpd.erl |
|---|---|
| 2 | =================================================================== |
| 3 | --- src/couchdb/couch_httpd.erl (revision 660166) |
| 4 | +++ src/couchdb/couch_httpd.erl (working copy) |
| 5 | @@ -164,7 +164,7 @@ |
| 6 | |
| 7 | handle_db_request(Req, 'DELETE', {DbName, _Db, []}) -> |
| 8 | ok = couch_server:delete(DbName), |
| 9 | - send_json(Req, 202, {obj, [ |
| 10 | + send_json(Req, 200, {obj, [ |
| 11 | {ok, true} |
| 12 | ]}); |
| 13 | |
| 14 | @@ -451,7 +451,7 @@ |
| 15 | throw({bad_request, "Document rev and etag have different values"}) |
| 16 | end, |
| 17 | {ok, NewRev} = couch_db:delete_doc(Db, DocId, [RevToDelete]), |
| 18 | - send_json(Req, 202, {obj, [ |
| 19 | + send_json(Req, 200, {obj, [ |
| 20 | {ok, true}, |
| 21 | {id, DocId}, |
| 22 | {rev, NewRev} |
| 23 | Index: share/www/script/jquery.couch.js |
| 24 | =================================================================== |
| 25 | --- share/www/script/jquery.couch.js (revision 660170) |
| 26 | +++ share/www/script/jquery.couch.js (working copy) |
| 27 | @@ -78,7 +78,7 @@ |
| 28 | type: "DELETE", url: this.uri, dataType: "json", |
| 29 | complete: function(req) { |
| 30 | var resp = $.httpData(req, "json"); |
| 31 | - if (req.status == 202) { |
| 32 | + if (req.status == 200) { |
| 33 | if (options.success) options.success(resp); |
| 34 | } else if (options.error) { |
| 35 | options.error(req.status, resp.error, resp.reason); |
| 36 | @@ -176,7 +176,7 @@ |
| 37 | dataType: "json", |
| 38 | complete: function(req) { |
| 39 | var resp = $.httpData(req, "json"); |
| 40 | - if (req.status == 202) { |
| 41 | + if (req.status == 200) { |
| 42 | if (options.success) options.success(resp); |
| 43 | } else if (options.error) { |
| 44 | options.error(req.status, resp.error, resp.reason); |
| 45 | Index: share/www/script/couch.js |
| 46 | =================================================================== |
| 47 | --- share/www/script/couch.js (revision 660170) |
| 48 | +++ share/www/script/couch.js (working copy) |
| 49 | @@ -33,7 +33,7 @@ |
| 50 | if (req.status == 404) |
| 51 | return false; |
| 52 | var result = JSON.parse(req.responseText); |
| 53 | - if (req.status != 202) |
| 54 | + if (req.status != 200) |
| 55 | throw result; |
| 56 | return result; |
| 57 | } |
| 58 | @@ -73,7 +73,7 @@ |
| 59 | this.deleteDoc = function(doc) { |
| 60 | var req = request("DELETE", this.uri + encodeURIComponent(doc._id) + "?rev=" + doc._rev); |
| 61 | var result = JSON.parse(req.responseText); |
| 62 | - if (req.status != 202) |
| 63 | + if (req.status != 200) |
| 64 | throw result; |
| 65 | doc._rev = result.rev; //record rev in input document |
| 66 | doc._deleted = true; |
Comments
No comments so far.
