mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
add URI scheme checking
This commit is contained in:
parent
fa182b1284
commit
acd4406e1d
1 changed files with 6 additions and 0 deletions
|
@ -1,8 +1,10 @@
|
|||
require 'uri'
|
||||
|
||||
module HTTParty
|
||||
|
||||
class Request #:nodoc:
|
||||
SupportedHTTPMethods = [Net::HTTP::Get, Net::HTTP::Post, Net::HTTP::Put, Net::HTTP::Delete]
|
||||
SupportedURISchemes = [URI::HTTP, URI::HTTPS]
|
||||
|
||||
attr_accessor :http_method, :path, :options
|
||||
|
||||
|
@ -27,6 +29,10 @@ module HTTParty
|
|||
new_uri.query = query_string(new_uri)
|
||||
end
|
||||
|
||||
unless SupportedURISchemes.include? new_uri.class
|
||||
raise ArgumentError, "Cannot parse '#{new_uri}' as a supported URI class"
|
||||
end
|
||||
|
||||
new_uri
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue