You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
module HTTParty
module ClassMethods
def default_body_params(h={})
raise ArgumentError, 'Default body params must be a hash' unless h.is_a?(Hash)
default_options[:default_body_params] ||= {}
default_options[:default_body_params].merge!(h)
end
end
class Request
def body
if options[:default_body_params]
if options[:body]
if options[:body].is_a?(Hash)
options[:body] = options[:default_body_params].merge(options[:body])
end
else
options[:body] = options[:default_body_params]
end
end
if options[:body].is_a?(Hash)
options[:body].to_params
else
options[:body]
end
end
end
end
It'd be nice if default params did the same functionality for POST requests, ie add the default params to the body instead of the query_string.
The text was updated successfully, but these errors were encountered: