mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
extract out options assignment to method
This commit is contained in:
parent
06e4dcdaed
commit
58fc195b6f
1 changed files with 7 additions and 3 deletions
|
@ -519,9 +519,7 @@ module HTTParty
|
|||
|
||||
# Perform a HEAD request to a path
|
||||
def head(path, options = {}, &block)
|
||||
unless options.has_key?(:maintain_method_across_redirects)
|
||||
options[:maintain_method_across_redirects] = true
|
||||
end
|
||||
ensure_method_maintained_across_redirects options
|
||||
perform_request Net::HTTP::Head, path, options, &block
|
||||
end
|
||||
|
||||
|
@ -534,6 +532,12 @@ module HTTParty
|
|||
|
||||
private
|
||||
|
||||
def ensure_method_maintained_across_redirects(options)
|
||||
unless options.has_key? :maintain_method_across_redirects
|
||||
options[:maintain_method_across_redirects] = true
|
||||
end
|
||||
end
|
||||
|
||||
def perform_request(http_method, path, options, &block) #:nodoc:
|
||||
options = ModuleInheritableAttributes.hash_deep_dup(default_options).merge(options)
|
||||
process_headers(options)
|
||||
|
|
Loading…
Add table
Reference in a new issue