1
0
Fork 0
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:
John Hyland 2009-10-28 17:39:34 -04:00 committed by Sandro Turriate
parent fa182b1284
commit acd4406e1d

View file

@ -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