summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2012-01-07 19:49:39 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2012-01-07 19:54:09 +0000
commit3587e084ec24989fb1842a0059e52537e7eb96db (patch)
tree5b8130bcd5e407b7ca493a504d191d2341e0f521
parent0d8ddc8082af4f44f292a7192f1971d4e7c11bb2 (diff)
downloadcouchdb-3587e084ec24989fb1842a0059e52537e7eb96db.tar.gz
Don't send Content-Type in GET/HEAD requests
This partially reverts 55d2c9e390cf06a76ff6715a60b85f8f4ca26f97, adding only a Content-Type of application/json to post requests against _revs_diff.
-rw-r--r--src/couchdb/couch_api_wrap.erl10
-rw-r--r--src/couchdb/couch_api_wrap.hrl1
2 files changed, 7 insertions, 4 deletions
diff --git a/src/couchdb/couch_api_wrap.erl b/src/couchdb/couch_api_wrap.erl
index c97c6c58b..75436ffd8 100644
--- a/src/couchdb/couch_api_wrap.erl
+++ b/src/couchdb/couch_api_wrap.erl
@@ -122,7 +122,8 @@ get_db_info(#db{name = DbName, user_ctx = UserCtx}) ->
ensure_full_commit(#httpdb{} = Db) ->
send_req(
Db,
- [{method, post}, {path, "_ensure_full_commit"}],
+ [{method, post}, {path, "_ensure_full_commit"},
+ {headers, [{"Content-Type", "application/json"}]}],
fun(201, _, {Props}) ->
{ok, get_value(<<"instance_start_time">>, Props)};
(_, _, {Props}) ->
@@ -136,7 +137,8 @@ get_missing_revs(#httpdb{} = Db, IdRevs) ->
JsonBody = {[{Id, couch_doc:revs_to_strs(Revs)} || {Id, Revs} <- IdRevs]},
send_req(
Db,
- [{method, post}, {path, "_revs_diff"}, {body, ?JSON_ENCODE(JsonBody)}],
+ [{method, post}, {path, "_revs_diff"}, {body, ?JSON_ENCODE(JsonBody)},
+ {headers, [{"Content-Type", "application/json"}]}],
fun(200, _, {Props}) ->
ConvertToNativeFun = fun({Id, {Result}}) ->
MissingRevs = couch_doc:parse_revs(
@@ -287,6 +289,7 @@ update_docs(#httpdb{} = HttpDb, DocList, Options, UpdateType) ->
end,
Headers = [
{"Content-Length", Len},
+ {"Content-Type", "application/json"},
{"X-Couch-Full-Commit", FullCommit}
],
send_req(
@@ -319,8 +322,9 @@ changes_since(#httpdb{headers = Headers1} = HttpDb, Style, StartSeq,
QArgs1 = maybe_add_changes_filter_q_args(BaseQArgs, Options),
{QArgs1, get, [], Headers1};
_ when is_list(DocIds) ->
+ Headers2 = [{"Content-Type", "application/json"} | Headers1],
JsonDocIds = ?JSON_ENCODE({[{<<"doc_ids">>, DocIds}]}),
- {[{"filter", "_doc_ids"} | BaseQArgs], post, JsonDocIds, Headers1}
+ {[{"filter", "_doc_ids"} | BaseQArgs], post, JsonDocIds, Headers2}
end,
send_req(
HttpDb,
diff --git a/src/couchdb/couch_api_wrap.hrl b/src/couchdb/couch_api_wrap.hrl
index 8dd594a29..1a6f27a09 100644
--- a/src/couchdb/couch_api_wrap.hrl
+++ b/src/couchdb/couch_api_wrap.hrl
@@ -17,7 +17,6 @@
oauth = nil,
headers = [
{"Accept", "application/json"},
- {"Content-Type", "application/json"},
{"User-Agent", "CouchDB/" ++ couch_server:get_version()}
],
timeout, % milliseconds