summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2009-07-11 17:00:42 +0000
committerJan Lehnardt <jan@apache.org>2009-07-11 17:00:42 +0000
commitdeae5e14975c0726feb28c7e0be433e650c40f30 (patch)
tree59b08d374742b69dcea88d42884b90090fb0bfc6 /src/couchdb
parent270d1e004e3bed8fc21bbe37676292227d720dc3 (diff)
send Location header for new or updated attachments
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@793205 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_httpd_db.erl14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 3b5fcbe8..3277af08 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -842,7 +842,19 @@ db_attachment_req(#httpd{method=Method}=Req, Db, DocId, FileNameParts)
attachments = NewAttachment ++ proplists:delete(FileName, Attachments)
},
{ok, UpdatedRev} = couch_db:update_doc(Db, DocEdited, []),
- send_json(Req, case Method of 'DELETE' -> 200; _ -> 201 end, {[
+ #db{name=DbName} = Db,
+
+ {Status, Headers} = case Method of
+ 'DELETE' ->
+ {200, []};
+ _ ->
+ {201, [{"Location", absolute_uri(Req, "/" ++
+ binary_to_list(DbName) ++ "/" ++
+ binary_to_list(DocId) ++ "/" ++
+ binary_to_list(FileName)
+ )}]}
+ end,
+ send_json(Req,Status, Headers, {[
{ok, true},
{id, DocId},
{rev, couch_doc:rev_to_str(UpdatedRev)}