nice_http 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/nice_http.rb +7 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47aaac0ea84048f15e65208787fe9fe18ea734e264cf96c5b3ae6473fa6971d5
4
- data.tar.gz: 48cafa2269b3652f9b67647885f121540fb34d6985363122e5249b1a2fc7387e
3
+ metadata.gz: cffd946cebf53c5c36b4c5ec3a6d242884133e84f383571ad9474132b8de042b
4
+ data.tar.gz: 8fc3fa195125d78c4aa933c141cee357618274391e3f9e0a79f56e6e6aadf4d0
5
5
  SHA512:
6
- metadata.gz: 823866bee428c4687b7cd9d1091aef985dcfb15ddd8db7ed5a45b15c86b2431bb0abd3d48d954df63409101e61c984cd97d4d2352fefd6f8a3cf23a2f5fdda9a
7
- data.tar.gz: f7c0bf035c8b226150235eb362f913f1c7c41e616183ffc9cedd7f9c0b5c4b71d46a8149a6def043dda72e3dbb2f3c8911a78ce0e230c38a9ed8d8b4d86b7708
6
+ metadata.gz: 400df088538e0f5d53b5e2db525d411498c70336fe5adcca2cd7ee8bc06805e07729270bfc54550ae22e828e7818a6adab54ce50d2c86388f0eae56a970be3b0
7
+ data.tar.gz: 4d4ab9ab1ae81843bebfa3013643c874777f5882340946753d528a5fe87554b21e18177c720147ced90a95928cab8a32ea8679cb90608373a9d69e660f6f3ae0
data/README.md CHANGED
@@ -62,7 +62,7 @@ http3 = NiceHttp.new my_reqres_server
62
62
  ```
63
63
 
64
64
 
65
- You can specify all the defaults you will be using when creating connections by using the NiceHttp methods, in this example, http1 and http2 will be connecting to regres.in and http3 to example.com:
65
+ You can specify all the defaults you will be using when creating connections by using the NiceHttp methods, in this example, http1 and http2 will be connecting to reqres.in and http3 to example.com:
66
66
 
67
67
  ```ruby
68
68
 
data/lib/nice_http.rb CHANGED
@@ -102,6 +102,13 @@ class NiceHttp
102
102
  @auto_redirect = args[:auto_redirect] if args.keys.include?(:auto_redirect)
103
103
  end
104
104
 
105
+ if @host.include?("http:") or @host.include?("https:")
106
+ uri = URI.parse(@host)
107
+ @host = uri.host unless uri.host.nil?
108
+ @port = uri.port unless uri.port.nil?
109
+ @ssl = true if !uri.scheme.nil? && (uri.scheme == 'https')
110
+ end
111
+
105
112
  if !@proxy_host.nil? && !@proxy_port.nil?
106
113
  @http = Net::HTTP::Proxy(@proxy_host, @proxy_port).new(@host, @port)
107
114
  @http.use_ssl = @ssl
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nice_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz