Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add some test cases for https requests.

  • Loading branch information...
commit fb9d0f75be0c2af7a7ecec1ab661cb20bd693cca 1 parent d4eecce
Myron Marston authored April 07, 2011
9  spec/support/http_library_adapters.rb
@@ -11,7 +11,14 @@ def get_header(header_key, response)
11 11
 
12 12
   def make_http_request(method, url, body = nil, headers = {})
13 13
     uri = URI.parse(url)
14  
-    Net::HTTP.new(uri.host, uri.port).send_request(method.to_s.upcase, uri.request_uri, body, headers)
  14
+    http = Net::HTTP.new(uri.host, uri.port)
  15
+
  16
+    if uri.scheme == "https"
  17
+      http.use_ssl = true
  18
+      http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  19
+    end
  20
+
  21
+    http.send_request(method.to_s.upcase, uri.request_uri, body, headers)
15 22
   end
16 23
 end
17 24
 
3  spec/support/shared_example_groups/http_library.rb
@@ -79,6 +79,9 @@ def self.test_url(description, url)
79 79
         end
80 80
       end
81 81
 
  82
+      test_url "using https and no explicit port", "https://example.com/foo"
  83
+      test_url "using https and port 443", "https://example.com:443/foo"
  84
+      test_url "using https and some other port", "https://example.com:5190/foo"
82 85
       test_url "that has query params",      "http://example.com/search?q=param"
83 86
       test_url "with spaces encoded as +",   "http://example.com/search?q=a+b"
84 87
       test_url "with spaces encoded as %20", "http://example.com/search?q=a%20b"

0 notes on commit fb9d0f7

Please sign in to comment.
Something went wrong with that request. Please try again.