nice_http 0.9.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/nice_http.rb +9 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 231751412f91ccd16d4ac7d701b3385afacfa4805bab102b50e2cff2cb572c1a
|
4
|
+
data.tar.gz: 1b69935d11c7298b22b4040d556467323b6fbb2d537eaf124c6a1acce8a510a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38460eae904950f28d135ab06d294ce2c905d49cf373e4defc30a34303826c09720756807a46bfd551ca69a79f834c1acc0bd92e6fe7946bcaaa44ff5354e0e8
|
7
|
+
data.tar.gz: 7790e3affbae979ee63e79a712fb1d0f645733376bf98eb9253890c23c9fb57c6ed8913b3e43e62a56483e4d4e8bd6993cdfdcb29eba52fa524bce057123e794
|
data/README.md
CHANGED
@@ -12,6 +12,8 @@ NiceHttp will take care of the redirections and the cookies, and for security te
|
|
12
12
|
|
13
13
|
To be able to generate random requests take a look at the documentation for nice_hash gem: https://github.com/MarioRuiz/nice_hash
|
14
14
|
|
15
|
+
Example that creates 1000 good random and unique requests to register an user and test that the validation of the fields are correct by the user was able to be registered. Send 800 requests where just one field is wrong and verify the user was not able to be created: https://gist.github.com/MarioRuiz/824d7a462b62fd85f02c1a09455deefb
|
16
|
+
|
15
17
|
## Installation
|
16
18
|
|
17
19
|
Install it yourself as:
|
data/lib/nice_http.rb
CHANGED
@@ -102,13 +102,20 @@ 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:")
|
105
|
+
if @host.to_s!="" and (@host.include?("http:") or @host.include?("https:"))
|
106
106
|
uri = URI.parse(@host)
|
107
107
|
@host = uri.host unless uri.host.nil?
|
108
108
|
@port = uri.port unless uri.port.nil?
|
109
109
|
@ssl = true if !uri.scheme.nil? && (uri.scheme == 'https')
|
110
110
|
end
|
111
111
|
|
112
|
+
if @host.nil? or @host.to_s=="" or @port.nil? or @port.to_s==""
|
113
|
+
message = "It was not possible to create the http connection!!!\n"
|
114
|
+
message += "Wrong host or port, remember to supply http:// or https:// in case you specify an url to create the http connection, for example:\n"
|
115
|
+
message += "http = NiceHttp.new('http://example.com')"
|
116
|
+
raise message
|
117
|
+
end
|
118
|
+
|
112
119
|
if !@proxy_host.nil? && !@proxy_port.nil?
|
113
120
|
@http = Net::HTTP::Proxy(@proxy_host, @proxy_port).new(@host, @port)
|
114
121
|
@http.use_ssl = @ssl
|
@@ -155,6 +162,7 @@ class NiceHttp
|
|
155
162
|
rescue Exception => stack
|
156
163
|
if @logger.nil?
|
157
164
|
puts stack
|
165
|
+
@logger = Logger.new nil
|
158
166
|
else
|
159
167
|
@logger.fatal stack
|
160
168
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nice_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nice_hash
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.6'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.6.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
29
|
+
version: '1.6'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
32
|
+
version: 1.6.0
|
33
33
|
description: NiceHttp -- simplest library for accessing and testing HTTP and REST
|
34
34
|
resources. Manage different hosts on the fly. Easily get the value you want from
|
35
35
|
the JSON strings. Use hashes on your requests.
|