lib/gitlab/request.rb in gitlab-4.13.1 vs lib/gitlab/request.rb in gitlab-4.14.0
- old
+ new
@@ -39,17 +39,19 @@
raise Error::Parsing, 'The response is not a valid JSON'
end
%w[get post put delete].each do |method|
define_method method do |path, options = {}|
- httparty_config(options)
+ params = options.dup
- unless options[:unauthenticated]
- options[:headers] ||= {}
- options[:headers].merge!(authorization_header)
+ httparty_config(params)
+
+ unless params[:unauthenticated]
+ params[:headers] ||= {}
+ params[:headers].merge!(authorization_header)
end
- validate self.class.send(method, @endpoint + path, options)
+ validate self.class.send(method, @endpoint + path, params)
end
end
# Checks the response code for common errors.
# Returns parsed response for successful requests.