lib/chicanery/site.rb in chicanery-0.1.4 vs lib/chicanery/site.rb in chicanery-0.1.5
- old
+ new
@@ -8,12 +8,15 @@
def initialize name, url, options={}
@name, @uri, @options = name, URI(url), options
end
+ def path
+ uri.query ? "#{uri.path}?#{uri.query}" : uri.path
+ end
+
def get
- req = Net::HTTP::Get.new uri.path
- req += "?#{uri.query}" if uri.query
+ req = Net::HTTP::Get.new path
req.basic_auth options[:user], options[:password] if options[:user] and options[:password]
http_opts = { use_ssl: uri.scheme == 'https' }
http_opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE unless options[:verify_ssl]
start = Time.now
res = Net::HTTP.start uri.host, uri.port, http_opts do |https|
\ No newline at end of file