You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2012/11/08 23:44:11 UTC

[14/15] git commit: Only return X-Couch-Id (rev is available in ETag)

Only return X-Couch-Id (rev is available in ETag)


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/4e181939
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4e181939
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4e181939

Branch: refs/heads/431-feature_cors
Commit: 4e1819393ba1117dcc87636079f48acb315c0414
Parents: 57ce0ea
Author: Benjamin Nortier <bj...@gmail.com>
Authored: Fri Sep 21 16:46:46 2012 +0100
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Nov 8 23:37:33 2012 +0100

----------------------------------------------------------------------
 src/couchdb/couch_httpd.erl |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/4e181939/src/couchdb/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index dae4af3..eea530c 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -715,19 +715,19 @@ send_json(Req, Code, Headers, Value) ->
         {"Content-Type", negotiate_content_type(Req)},
         {"Cache-Control", "must-revalidate"}
     ],
-    IdAndRevHeaders = case Value of
-                      {Props} when is_list(Props) ->
-                          case {lists:keyfind(id, 1, Props), lists:keyfind(rev, 1, Props)} of
-                          {{_, Id}, {_, Rev}} ->
-                              [{"X-Couch-Id", Id}, {"X-Couch-Rev", Rev}];
-                          _ ->
-                              []
-                          end;
-                      _ ->
-                          []
-                      end,
+    IdHeader = case Value of
+                   {Props} when is_list(Props) ->
+                       case lists:keyfind(id, 1, Props) of
+                           {_, Id} ->
+                               [{"X-Couch-Id", Id}];
+                           _ ->
+                               []
+                       end;
+                   _ ->
+                       []
+               end,
     Body = [start_jsonp(), ?JSON_ENCODE(Value), end_jsonp(), $\n],
-    send_response(Req, Code, DefaultHeaders ++ IdAndRevHeaders ++ Headers, Body).
+    send_response(Req, Code, DefaultHeaders ++ IdHeader ++ Headers, Body).
 
 start_json_response(Req, Code) ->
     start_json_response(Req, Code, []).