Skip to content

Commit

Permalink
Only return X-Couch-Id (rev is available in ETag)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjnortier authored and janl committed Nov 2, 2012
1 parent 0a64f31 commit 4edbb93
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/couchdb/couch_httpd.erl
Expand Up @@ -692,19 +692,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, []).
Expand Down

0 comments on commit 4edbb93

Please sign in to comment.