diff options
-rw-r--r-- | share/www/script/test/oauth.js | 4 | ||||
-rw-r--r-- | src/couchdb/couch_httpd_oauth.erl | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/share/www/script/test/oauth.js b/share/www/script/test/oauth.js index 1456bb30..6048a0ce 100644 --- a/share/www/script/test/oauth.js +++ b/share/www/script/test/oauth.js @@ -133,6 +133,10 @@ couchTests.oauth = function(debug) { xhr = oauthRequest("http://" + host + "/_session?foo=bar", message, accessor); T(xhr.status == expectedCode); + // Test HEAD method + xhr = oauthRequest("http://" + host + "/_session?foo=bar", message, accessor, "HEAD"); + T(xhr.status == expectedCode); + // Replication var result = CouchDB.replicate(dbPair.source, dbPair.target); T(result.ok); diff --git a/src/couchdb/couch_httpd_oauth.erl b/src/couchdb/couch_httpd_oauth.erl index f542a989..ee79c797 100644 --- a/src/couchdb/couch_httpd_oauth.erl +++ b/src/couchdb/couch_httpd_oauth.erl @@ -16,11 +16,11 @@ -export([oauth_authentication_handler/1, handle_oauth_req/1, consumer_lookup/2]). % OAuth auth handler using per-node user db -oauth_authentication_handler(#httpd{method=Method}=Req) -> +oauth_authentication_handler(#httpd{mochi_req=MochiReq}=Req) -> serve_oauth(Req, fun(URL, Params, Consumer, Signature) -> AccessToken = proplists:get_value("oauth_token", Params), TokenSecret = couch_config:get("oauth_token_secrets", AccessToken), - case oauth:verify(Signature, atom_to_list(Method), URL, Params, Consumer, TokenSecret) of + case oauth:verify(Signature, atom_to_list(MochiReq:get(method)), URL, Params, Consumer, TokenSecret) of true -> set_user_ctx(Req, AccessToken); false -> |