lib/chicanery/site.rb in chicanery-0.1.3 vs lib/chicanery/site.rb in chicanery-0.1.4
- old
+ new
@@ -1,6 +1,7 @@
require 'net/http'
+require 'openssl'
require 'benchmark'
module Chicanery
class Site
attr_reader :name, :uri, :options, :body, :code, :duration
@@ -9,9 +10,10 @@
@name, @uri, @options = name, URI(url), options
end
def get
req = Net::HTTP::Get.new uri.path
+ req += "?#{uri.query}" if uri.query
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