summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2016-09-30 12:21:05 +0100
committerNick Thomas <nick@gitlab.com>2016-10-06 15:07:25 +0100
commit86c0c0869dd4b9de301822a7d598bc4528604e5a (patch)
tree3669bb3ee240b86848f0712c2cca492ad1280638
parent9802d3883fb42dd31f91d71018ac87ba0c32d1c1 (diff)
downloadgitlab-ce-86c0c0869dd4b9de301822a7d598bc4528604e5a.tar.gz
Switch from request to env in ::API::Helpers
Per https://gitlab.com/gitlab-org/gitlab-ce/issues/22820, this helper is mixed in to classes that lack a `request` method. They do include `env`, so use it instead.
-rw-r--r--lib/api/helpers.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 8b8c4eb4d46..281a8f13531 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -25,7 +25,7 @@ module API
# Until CSRF protection is added to the API, disallow this method for
# state-changing endpoints
def find_user_from_warden
- warden.try(:authenticate) if request.get? || request.head?
+ warden.try(:authenticate) if %w[GET HEAD].include?(env['REQUEST_METHOD'])
end
def find_user_by_private_token