httpi 2.0.0.rc1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -1
- data/Gemfile +0 -1
- data/httpi.gemspec +5 -5
- data/lib/httpi.rb +13 -11
- data/lib/httpi/adapter/curb.rb +3 -0
- data/lib/httpi/adapter/httpclient.rb +3 -0
- data/lib/httpi/adapter/net_http.rb +3 -0
- data/lib/httpi/request.rb +15 -0
- data/lib/httpi/version.rb +1 -1
- data/spec/httpi/adapter/net_http_spec.rb +84 -10
- data/spec/httpi/error_spec.rb +43 -0
- data/spec/httpi/httpi_spec.rb +15 -3
- data/spec/httpi/request_spec.rb +29 -0
- data/spec/integration/curb_spec.rb +99 -0
- data/spec/integration/em_http_spec.rb +81 -0
- data/spec/integration/httpclient_spec.rb +94 -0
- data/spec/integration/net_http_spec.rb +86 -0
- data/spec/integration/support/application.rb +56 -0
- data/spec/integration/support/server.rb +84 -0
- data/spec/spec_helper.rb +7 -3
- data/spec/support/error_helper.rb +26 -0
- metadata +98 -111
- data/spec/integration/fixtures/ca.pem +0 -23
- data/spec/integration/fixtures/htdigest +0 -1
- data/spec/integration/fixtures/htpasswd +0 -2
- data/spec/integration/fixtures/subca.pem +0 -21
- data/spec/integration/request_spec.rb +0 -112
- data/spec/integration/server.rb +0 -39
- data/spec/integration/ssl_server.rb +0 -70
- data/spec/integration/ssl_spec.rb +0 -102
metadata
CHANGED
@@ -1,109 +1,103 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpi
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
- rc
|
11
|
-
- 1
|
12
|
-
version: 2.0.0.rc1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
13
6
|
platform: ruby
|
14
|
-
authors:
|
7
|
+
authors:
|
15
8
|
- Daniel Harrington
|
16
9
|
- Martin Tepper
|
17
10
|
autorequire:
|
18
11
|
bindir: bin
|
19
12
|
cert_chain: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
dependencies:
|
24
|
-
- !ruby/object:Gem::Dependency
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ">="
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 3
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
version: "0"
|
34
|
-
version_requirements: *id001
|
13
|
+
date: 2012-12-16 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
35
16
|
name: rack
|
36
|
-
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
37
23
|
type: :runtime
|
38
|
-
|
39
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
26
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
|
46
|
-
- 0
|
47
|
-
- 9
|
48
|
-
version: "0.9"
|
49
|
-
version_requirements: *id002
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
50
32
|
name: rake
|
51
|
-
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '10.0'
|
52
39
|
type: :development
|
53
|
-
|
54
|
-
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
42
|
none: false
|
56
|
-
requirements:
|
43
|
+
requirements:
|
57
44
|
- - ~>
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
61
|
-
- 2
|
62
|
-
- 11
|
63
|
-
version: "2.11"
|
64
|
-
version_requirements: *id003
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '10.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
65
48
|
name: rspec
|
66
|
-
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.12'
|
67
55
|
type: :development
|
68
|
-
|
69
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
58
|
none: false
|
71
|
-
requirements:
|
59
|
+
requirements:
|
72
60
|
- - ~>
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
|
76
|
-
- 0
|
77
|
-
- 12
|
78
|
-
version: "0.12"
|
79
|
-
version_requirements: *id004
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.12'
|
63
|
+
- !ruby/object:Gem::Dependency
|
80
64
|
name: mocha
|
81
|
-
|
82
|
-
type: :development
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
85
66
|
none: false
|
86
|
-
requirements:
|
67
|
+
requirements:
|
87
68
|
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
|
90
|
-
|
91
|
-
- 1
|
92
|
-
- 8
|
93
|
-
version: "1.8"
|
94
|
-
version_requirements: *id005
|
95
|
-
name: webmock
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0.13'
|
71
|
+
type: :development
|
96
72
|
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0.13'
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: puma
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 2.0.0.b3
|
97
87
|
type: :development
|
98
|
-
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 2.0.0.b3
|
95
|
+
description: Common interface for Ruby's HTTP libraries
|
99
96
|
email: me@rubiii.com
|
100
97
|
executables: []
|
101
|
-
|
102
98
|
extensions: []
|
103
|
-
|
104
99
|
extra_rdoc_files: []
|
105
|
-
|
106
|
-
files:
|
100
|
+
files:
|
107
101
|
- .gitignore
|
108
102
|
- .rspec
|
109
103
|
- .rvmrc
|
@@ -146,58 +140,51 @@ files:
|
|
146
140
|
- spec/httpi/auth/ssl_spec.rb
|
147
141
|
- spec/httpi/cookie_spec.rb
|
148
142
|
- spec/httpi/cookie_store_spec.rb
|
143
|
+
- spec/httpi/error_spec.rb
|
149
144
|
- spec/httpi/httpi_spec.rb
|
150
145
|
- spec/httpi/request_spec.rb
|
151
146
|
- spec/httpi/response_spec.rb
|
152
|
-
- spec/integration/
|
147
|
+
- spec/integration/curb_spec.rb
|
148
|
+
- spec/integration/em_http_spec.rb
|
153
149
|
- spec/integration/fixtures/ca_all.pem
|
154
|
-
- spec/integration/fixtures/htdigest
|
155
|
-
- spec/integration/fixtures/htpasswd
|
156
150
|
- spec/integration/fixtures/server.cert
|
157
151
|
- spec/integration/fixtures/server.key
|
158
|
-
- spec/integration/
|
159
|
-
- spec/integration/
|
160
|
-
- spec/integration/
|
161
|
-
- spec/integration/
|
162
|
-
- spec/integration/ssl_spec.rb
|
152
|
+
- spec/integration/httpclient_spec.rb
|
153
|
+
- spec/integration/net_http_spec.rb
|
154
|
+
- spec/integration/support/application.rb
|
155
|
+
- spec/integration/support/server.rb
|
163
156
|
- spec/spec_helper.rb
|
157
|
+
- spec/support/error_helper.rb
|
164
158
|
- spec/support/fixture.rb
|
165
159
|
- spec/support/matchers.rb
|
166
|
-
has_rdoc: true
|
167
160
|
homepage: http://github.com/savonrb/httpi
|
168
161
|
licenses: []
|
169
|
-
|
170
162
|
post_install_message:
|
171
163
|
rdoc_options: []
|
172
|
-
|
173
|
-
require_paths:
|
164
|
+
require_paths:
|
174
165
|
- lib
|
175
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
176
167
|
none: false
|
177
|
-
requirements:
|
178
|
-
- -
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
|
181
|
-
segments:
|
168
|
+
requirements:
|
169
|
+
- - ! '>='
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
segments:
|
182
173
|
- 0
|
183
|
-
|
184
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
+
hash: -511386314545034600
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
176
|
none: false
|
186
|
-
requirements:
|
187
|
-
- -
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
|
190
|
-
segments:
|
191
|
-
-
|
192
|
-
-
|
193
|
-
- 1
|
194
|
-
version: 1.3.1
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
segments:
|
182
|
+
- 0
|
183
|
+
hash: -511386314545034600
|
195
184
|
requirements: []
|
196
|
-
|
197
185
|
rubyforge_project: httpi
|
198
|
-
rubygems_version: 1.
|
186
|
+
rubygems_version: 1.8.24
|
199
187
|
signing_key:
|
200
188
|
specification_version: 3
|
201
189
|
summary: Common interface for Ruby's HTTP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ationServer, 4000).start
|
6
|
-
|
7
|
-
describe HTTPI do
|
8
|
-
let(:client) { HTTPI }
|
9
|
-
|
10
|
-
before :all do
|
11
|
-
WebMock.allow_net_connect!
|
12
|
-
|
13
|
-
@username = "admin"
|
14
|
-
@password = "pwd"
|
15
|
-
@error_message = "Authorization Required"
|
16
|
-
@example_web_page = "Hello"
|
17
|
-
@content_type = "text/plain"
|
18
|
-
end
|
19
|
-
|
20
|
-
shared_examples_for "an HTTP client" do
|
21
|
-
it "and send HTTP headers" do
|
22
|
-
request = HTTPI::Request.new :url => "http://localhost:4000/x-header"
|
23
|
-
request.headers["X-Header"] = "HTTPI"
|
24
|
-
|
25
|
-
response = HTTPI.get request, adapter
|
26
|
-
response.body.should include("X-Header is HTTPI")
|
27
|
-
end
|
28
|
-
|
29
|
-
it "and execute an HTTP GET request" do
|
30
|
-
response = HTTPI.get "http://localhost:4000", adapter
|
31
|
-
response.body.should include(@example_web_page)
|
32
|
-
response.headers["Content-Type"].should include(@content_type)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "and execute an HTTP POST request" do
|
36
|
-
response = HTTPI.post "http://localhost:4000", "<some>xml</some>", adapter
|
37
|
-
response.body.should include(@example_web_page)
|
38
|
-
response.headers["Content-Type"].should include(@content_type)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "and execute an HTTP HEAD request" do
|
42
|
-
response = HTTPI.head "http://localhost:4000", adapter
|
43
|
-
response.code.should == 200
|
44
|
-
response.headers["Content-Type"].should include(@content_type)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "and execute an HTTP PUT request" do
|
48
|
-
response = HTTPI.put "http://localhost:4000", "<some>xml</some>", adapter
|
49
|
-
response.body.should include("PUT is not allowed")
|
50
|
-
response.headers["Content-Type"].should include(@content_type)
|
51
|
-
end
|
52
|
-
|
53
|
-
it "and execute an HTTP DELETE request" do
|
54
|
-
response = HTTPI.delete "http://localhost:4000", adapter
|
55
|
-
response.body.should include("DELETE is not allowed")
|
56
|
-
response.headers["Content-Type"].should include(@content_type)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
shared_examples_for "it works with HTTP basic auth" do
|
61
|
-
it "and access a secured page" do
|
62
|
-
request = HTTPI::Request.new :url => "http://localhost:4000/auth/basic"
|
63
|
-
request.auth.basic @username, @password
|
64
|
-
|
65
|
-
response = HTTPI.get request, adapter
|
66
|
-
response.body.should_not include(@error_message)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
shared_examples_for "it works with HTTP digest auth" do
|
71
|
-
it "and access a secured page" do
|
72
|
-
request = HTTPI::Request.new :url => "http://localhost:4000/auth/digest"
|
73
|
-
request.auth.digest @username, @password
|
74
|
-
|
75
|
-
response = HTTPI.get request, adapter
|
76
|
-
response.body.should_not include(@error_message)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
HTTPI::Adapter::ADAPTERS.keys.each do |adapter|
|
81
|
-
if adapter == :em_http && RUBY_VERSION >= "1.9.0"
|
82
|
-
|
83
|
-
around(:each) do |example|
|
84
|
-
# Only wrap the example for the :em_http adapter
|
85
|
-
if EM.respond_to?(:synchrony)
|
86
|
-
EM.synchrony do
|
87
|
-
example.run
|
88
|
-
EM.stop
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
unless (adapter == :curb && RUBY_PLATFORM =~ /java/) || (adapter == :em_http && RUBY_VERSION =~ /1\.8/)
|
95
|
-
context "using :#{adapter}" do
|
96
|
-
let(:adapter) { adapter }
|
97
|
-
it_should_behave_like "an HTTP client"
|
98
|
-
it_should_behave_like "it works with HTTP basic auth"
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
(HTTPI::Adapter::ADAPTERS.keys - [:net_http]).each do |adapter|
|
104
|
-
unless (adapter == :curb && RUBY_PLATFORM =~ /java/) || adapter == :em_http
|
105
|
-
context "using :#{adapter}" do
|
106
|
-
let(:adapter) { adapter }
|
107
|
-
it_should_behave_like "it works with HTTP digest auth"
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
data/spec/integration/server.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "mock_server"
|
3
|
-
|
4
|
-
IntegrationServer = Rack::Builder.new do
|
5
|
-
map "/" do
|
6
|
-
run lambda {|env|
|
7
|
-
case env["REQUEST_METHOD"]
|
8
|
-
when "HEAD" then
|
9
|
-
[200, {"Content-Type" => "text/plain", "Content-Length" => "5"}, []]
|
10
|
-
when "GET", "POST" then
|
11
|
-
[200, {"Content-Type" => "text/plain", "Content-Length" => "5"}, ["Hello"]]
|
12
|
-
when "PUT", "DELETE"
|
13
|
-
body = "#{env["REQUEST_METHOD"]} is not allowed"
|
14
|
-
[200, {"Content-Type" => "text/plain", "Content-Length" => body.size.to_s}, [body]]
|
15
|
-
end
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
map "/x-header" do
|
20
|
-
run lambda {|env|
|
21
|
-
body = "X-Header is #{env["HTTP_X_HEADER"]}"
|
22
|
-
[200, {"Content-Type" => "text/plain", "Content-Length" => body.size.to_s}, [body]]
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
map "/auth" do
|
27
|
-
map "/basic" do
|
28
|
-
run Rack::Auth::Basic do |user, password|
|
29
|
-
user == "admin" && password == "secret"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
map "/digest" do
|
34
|
-
run Rack::Auth::Digest::MD5 do |username|
|
35
|
-
{"admin" => "pwd"}[username]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|