summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/www/script/browse.js2
-rw-r--r--share/www/script/couch.js4
-rw-r--r--share/www/script/couch_tests.js16
-rw-r--r--share/www/script/jquery.couch.js4
-rw-r--r--src/couchdb/couch_doc.erl15
-rw-r--r--src/couchdb/couch_httpd.erl4
6 files changed, 25 insertions, 20 deletions
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("<tt></tt>").appendTo(li);
$("<span>()</span>").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);
diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl
index cb70a576..9b7d6db9 100644
--- a/src/couchdb/couch_doc.erl
+++ b/src/couchdb/couch_doc.erl
@@ -51,8 +51,10 @@ to_json_obj(#doc{id=Id,deleted=Del,body=Body,revs=Revs,meta=Meta}=Doc,Options)->
true -> % return the full rev list and the binaries as strings.
BinProps = lists:map(
fun({Name, {Type, BinValue}}) ->
- {Name, {obj, [{"content-type", Type},
- {"data", couch_util:encodeBase64(bin_to_binary(BinValue))}]}}
+ {Name, {obj, [
+ {"content_type", Type},
+ {"data", couch_util:encodeBase64(bin_to_binary(BinValue))}
+ ]}}
end,
Doc#doc.attachments),
case BinProps of
@@ -62,8 +64,11 @@ to_json_obj(#doc{id=Id,deleted=Del,body=Body,revs=Revs,meta=Meta}=Doc,Options)->
false ->
BinProps = lists:map(
fun({Name, {Type, BinValue}}) ->
- {Name, {obj, [{"stub", true}, {"content-type", Type},
- {"length", bin_size(BinValue)}]}}
+ {Name, {obj, [
+ {"stub", true},
+ {"content_type", Type},
+ {"length", bin_size(BinValue)}
+ ]}}
end,
Doc#doc.attachments),
case BinProps of
@@ -81,7 +86,7 @@ from_json_obj({obj, Props}) ->
[{Name, stub}];
_ ->
Value = proplists:get_value("data", BinProps),
- Type = proplists:get_value("content-type", BinProps,
+ Type = proplists:get_value("content_type", BinProps,
?DEFAULT_ATTACHMENT_CONTENT_TYPE),
[{Name, {Type, couch_util:decodeBase64(Value)}}]
end
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index 7174a145..26bb0915 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -164,7 +164,7 @@ handle_db_request(Req, Method, {DbName, Rest}) ->
handle_db_request(Req, 'DELETE', {DbName, _Db, []}) ->
ok = couch_server:delete(DbName),
- send_json(Req, 202, {obj, [
+ send_json(Req, 200, {obj, [
{ok, true}
]});
@@ -451,7 +451,7 @@ handle_doc_request(Req, 'DELETE', _DbName, Db, DocId) ->
throw({bad_request, "Document rev and etag have different values"})
end,
{ok, NewRev} = couch_db:delete_doc(Db, DocId, [RevToDelete]),
- send_json(Req, 202, {obj, [
+ send_json(Req, 200, {obj, [
{ok, true},
{id, DocId},
{rev, NewRev}