httpi 2.4.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/development.yml +48 -0
  3. data/CHANGELOG.md +23 -0
  4. data/Gemfile +8 -6
  5. data/README.md +20 -16
  6. data/UPDATING.md +7 -0
  7. data/httpi.gemspec +5 -8
  8. data/lib/httpi/adapter/curb.rb +7 -2
  9. data/lib/httpi/adapter/em_http.rb +5 -4
  10. data/lib/httpi/adapter/excon.rb +6 -1
  11. data/lib/httpi/adapter/http.rb +9 -0
  12. data/lib/httpi/adapter/httpclient.rb +5 -0
  13. data/lib/httpi/adapter/net_http.rb +10 -2
  14. data/lib/httpi/adapter/net_http_persistent.rb +6 -2
  15. data/lib/httpi/auth/ssl.rb +53 -2
  16. data/lib/httpi/request.rb +2 -2
  17. data/lib/httpi/version.rb +1 -1
  18. data/spec/fixtures/client_cert.pem +18 -14
  19. data/spec/fixtures/client_key.pem +25 -13
  20. data/spec/httpi/adapter/curb_spec.rb +31 -7
  21. data/spec/httpi/adapter/em_http_spec.rb +23 -21
  22. data/spec/httpi/adapter/excon_spec.rb +28 -118
  23. data/spec/httpi/adapter/http_spec.rb +23 -96
  24. data/spec/httpi/adapter/httpclient_spec.rb +32 -0
  25. data/spec/httpi/adapter/net_http_persistent_spec.rb +31 -81
  26. data/spec/httpi/adapter/net_http_spec.rb +37 -181
  27. data/spec/httpi/auth/ssl_spec.rb +48 -0
  28. data/spec/httpi/httpi_spec.rb +2 -4
  29. data/spec/integration/curb_spec.rb +20 -0
  30. data/spec/integration/em_http_spec.rb +19 -2
  31. data/spec/integration/excon_spec.rb +67 -1
  32. data/spec/integration/fixtures/ca_all.pem +17 -42
  33. data/spec/integration/fixtures/server.cert +17 -17
  34. data/spec/integration/fixtures/server.key +25 -13
  35. data/spec/integration/http_spec.rb +47 -0
  36. data/spec/integration/httpclient_spec.rb +20 -0
  37. data/spec/integration/net_http_persistent_spec.rb +33 -3
  38. data/spec/integration/net_http_spec.rb +144 -1
  39. data/spec/integration/support/application.rb +3 -2
  40. data/spec/integration/support/server.rb +1 -2
  41. data/spec/spec_helper.rb +0 -2
  42. metadata +15 -43
  43. data/.travis.yml +0 -15
@@ -146,29 +146,36 @@ unless RUBY_PLATFORM =~ /java/
146
146
  end
147
147
  end
148
148
 
149
- describe "timeout" do
149
+ describe "timeout_ms" do
150
150
  it "is not set unless it's specified" do
151
- curb.expects(:timeout=).never
151
+ curb.expects(:timeout_ms=).never
152
152
  adapter.request(:get)
153
153
  end
154
154
 
155
- it "is set if specified" do
155
+ it "is set if specified read_timeout" do
156
156
  request.read_timeout = 30
157
- curb.expects(:timeout=).with(request.read_timeout)
157
+ curb.expects(:timeout_ms=).with(30_000)
158
+
159
+ adapter.request(:get)
160
+ end
161
+
162
+ it "is set if specified write_timeout" do
163
+ request.write_timeout = 30
164
+ curb.expects(:timeout_ms=).with(30_000)
158
165
 
159
166
  adapter.request(:get)
160
167
  end
161
168
  end
162
169
 
163
- describe "connect_timeout" do
170
+ describe "connect_timeout_ms" do
164
171
  it "is not set unless it's specified" do
165
- curb.expects(:connect_timeout=).never
172
+ curb.expects(:connect_timeout_ms=).never
166
173
  adapter.request(:get)
167
174
  end
168
175
 
169
176
  it "is set if specified" do
170
177
  request.open_timeout = 30
171
- curb.expects(:connect_timeout=).with(30)
178
+ curb.expects(:connect_timeout_ms=).with(30_000)
172
179
 
173
180
  adapter.request(:get)
174
181
  end
@@ -243,6 +250,13 @@ unless RUBY_PLATFORM =~ /java/
243
250
  request
244
251
  end
245
252
 
253
+ it 'sets ssl_cipher_list' do
254
+ request.auth.ssl.ciphers = ["AES128"]
255
+ curb.expects(:set).with(any_parameters).at_least(1)
256
+ curb.expects(:set).with(:ssl_cipher_list, anything)
257
+ adapter.request(:get)
258
+ end
259
+
246
260
  context 'sets ssl_version' do
247
261
  it 'defaults to nil when no ssl_version is specified' do
248
262
  curb.expects(:ssl_version=).with(nil)
@@ -271,6 +285,16 @@ unless RUBY_PLATFORM =~ /java/
271
285
  adapter.request(:get)
272
286
  end
273
287
  end
288
+ it 'raises error when min_version not nil' do
289
+ request.auth.ssl.min_version = :TLS1_2
290
+ expect{ adapter.request(:get) }.
291
+ to raise_error(HTTPI::NotSupportedError, 'Curb adapter does not support #min_version or #max_version. Please, use #ssl_version instead.')
292
+ end
293
+ it 'raises error when max_version not nil' do
294
+ request.auth.ssl.max_version = :TLS1_2
295
+ expect{ adapter.request(:get) }.
296
+ to raise_error(HTTPI::NotSupportedError, 'Curb adapter does not support #min_version or #max_version. Please, use #ssl_version instead.')
297
+ end
274
298
  end
275
299
 
276
300
  context "(for SSL client auth)" do
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "httpi/adapter/em_http"
3
3
  require "httpi/request"
4
4
 
5
- begin
5
+ unless RUBY_PLATFORM =~ /java/
6
6
  HTTPI::Adapter.load_adapter(:em_http)
7
7
 
8
8
  describe HTTPI::Adapter::EmHttpRequest do
@@ -89,15 +89,12 @@ begin
89
89
  end
90
90
 
91
91
  it "sets host, port and authorization" do
92
- url = 'http://example.com:80'
93
-
92
+ url = "http://example.com:80"
94
93
  connection_options = {
95
- :connect_timeout => nil,
96
- :inactivity_timeout => nil,
97
- :proxy => {
98
- :host => 'proxy-host.com',
99
- :port => 443,
100
- :authorization => ['username', 'password']
94
+ :proxy => {
95
+ :host => "proxy-host.com",
96
+ :port => 443,
97
+ :authorization => ["username", "password"]
101
98
  }
102
99
  }
103
100
 
@@ -111,8 +108,8 @@ begin
111
108
  it "is passed as a connection option" do
112
109
  request.open_timeout = 30
113
110
 
114
- url = 'http://example.com:80'
115
- connection_options = { :connect_timeout => 30, :inactivity_timeout => nil }
111
+ url = "http://example.com:80"
112
+ connection_options = { connect_timeout: 30 }
116
113
 
117
114
  EventMachine::HttpRequest.expects(:new).with(url, connection_options)
118
115
 
@@ -121,11 +118,22 @@ begin
121
118
  end
122
119
 
123
120
  describe "receive_timeout" do
124
- it "is passed as a connection option" do
121
+ it "is passed as a connection option (when read_timeout specified)" do
125
122
  request.read_timeout = 60
126
123
 
127
- url = 'http://example.com:80'
128
- connection_options = { :connect_timeout => nil, :inactivity_timeout => 60 }
124
+ url = "http://example.com:80"
125
+ connection_options = { inactivity_timeout: 60 }
126
+
127
+ EventMachine::HttpRequest.expects(:new).with(url, connection_options)
128
+
129
+ adapter
130
+ end
131
+
132
+ it "is passed as a connection option (when write_timeout specified)" do
133
+ request.write_timeout = 60
134
+
135
+ url = "http://example.com:80"
136
+ connection_options = { inactivity_timeout: 60 }
129
137
 
130
138
  EventMachine::HttpRequest.expects(:new).with(url, connection_options)
131
139
 
@@ -142,7 +150,7 @@ begin
142
150
 
143
151
  it "raises an error for HTTP digest auth" do
144
152
  request.auth.digest "username", "password"
145
- expect { adapter.request(:get) }.to raise_error
153
+ expect { adapter.request(:get) }.to raise_error HTTPI::NotSupportedError
146
154
  end
147
155
  end
148
156
 
@@ -169,10 +177,4 @@ begin
169
177
  end
170
178
 
171
179
  end
172
- rescue LoadError => e
173
- if e.message =~ /fiber/
174
- warn "LoadError: #{e.message} (EventMachine requires fibers)"
175
- else
176
- raise e
177
- end
178
180
  end
@@ -1,124 +1,34 @@
1
1
  require "spec_helper"
2
- require "integration/support/server"
3
-
4
- describe HTTPI::Adapter::Excon do
5
-
6
- subject(:adapter) { :excon }
7
-
8
- context "http requests" do
9
- before :all do
10
- @server = IntegrationServer.run
11
- end
12
-
13
- after :all do
14
- @server.stop
15
- end
16
-
17
- it "sends and receives HTTP headers" do
18
- request = HTTPI::Request.new(@server.url + "x-header")
19
- request.headers["X-Header"] = "HTTPI"
20
-
21
- response = HTTPI.get(request, adapter)
22
- expect(response.body).to include("HTTPI")
23
- end
24
-
25
- it "executes GET requests" do
26
- response = HTTPI.get(@server.url, adapter)
27
- expect(response.body).to eq("get")
28
- expect(response.headers["Content-Type"]).to eq("text/plain")
29
- end
30
-
31
- it "executes POST requests" do
32
- response = HTTPI.post(@server.url, "<some>xml</some>", adapter)
33
- expect(response.body).to eq("post")
34
- expect(response.headers["Content-Type"]).to eq("text/plain")
35
- end
36
-
37
- it "executes HEAD requests" do
38
- response = HTTPI.head(@server.url, adapter)
39
- expect(response.code).to eq(200)
40
- expect(response.headers["Content-Type"]).to eq("text/plain")
41
- end
42
-
43
- it "executes PUT requests" do
44
- response = HTTPI.put(@server.url, "<some>xml</some>", adapter)
45
- expect(response.body).to eq("put")
46
- expect(response.headers["Content-Type"]).to eq("text/plain")
47
- end
48
-
49
- it "executes DELETE requests" do
50
- response = HTTPI.delete(@server.url, adapter)
51
- expect(response.body).to eq("delete")
52
- expect(response.headers["Content-Type"]).to eq("text/plain")
53
- end
54
-
55
- it "supports basic authentication" do
56
- request = HTTPI::Request.new(@server.url + "basic-auth")
57
- request.auth.basic("admin", "secret")
58
-
59
- response = HTTPI.get(request, adapter)
60
- expect(response.body).to eq("basic-auth")
61
- end
62
-
63
- it "does not support ntlm authentication" do
64
- request = HTTPI::Request.new(@server.url + "ntlm-auth")
65
- request.auth.ntlm("tester", "vReqSoafRe5O")
66
-
67
- expect { HTTPI.get(request, adapter) }.
68
- to raise_error(HTTPI::NotSupportedError, /does not support NTLM authentication/)
69
- end
70
-
71
- it "supports disabling verify mode" do
72
- request = HTTPI::Request.new(@server.url)
73
- request.auth.ssl.verify_mode = :none
74
- adapter_class = HTTPI::Adapter.load(adapter).new(request)
75
- expect(adapter_class.client.data[:ssl_verify_peer]).to eq(false)
76
- end
77
- end
78
-
79
- # it does not support digest auth
80
-
81
- if RUBY_PLATFORM =~ /java/
82
- pending "Puma Server complains: SSL not supported on JRuby"
83
- else
84
- context "https requests" do
85
- before :all do
86
- @server = IntegrationServer.run(:ssl => true)
2
+ require "httpi/adapter/excon"
3
+ require "httpi/request"
4
+
5
+ begin
6
+ HTTPI::Adapter.load_adapter(:excon)
7
+
8
+ describe HTTPI::Adapter::Excon do
9
+ let(:adapter) { HTTPI::Adapter::Excon.new(request) }
10
+ let(:request) { HTTPI::Request.new("http://example.com") }
11
+
12
+ describe "settings" do
13
+ describe "connect_timeout, read_timeout, write_timeout" do
14
+ it "are passed as connection options" do
15
+ request.open_timeout = 30
16
+ request.read_timeout = 40
17
+ request.write_timeout = 50
18
+
19
+ expect(adapter.client.data).to include(
20
+ connect_timeout: 30,
21
+ read_timeout: 40,
22
+ write_timeout: 50
23
+ )
24
+ end
87
25
  end
88
- after :all do
89
- @server.stop
90
- end
91
-
92
- # it does not raise when no certificate was set up
93
- it "works when no client cert is specified" do
94
- request = HTTPI::Request.new(@server.url)
95
- request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
96
-
97
- response = HTTPI.get(request, adapter)
98
- expect(response.body).to eq("get")
99
- end
100
-
101
- it "works with client cert and key provided as file path" do
102
- request = HTTPI::Request.new(@server.url)
103
- request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
104
- request.auth.ssl.cert_file = "spec/fixtures/client_cert.pem"
105
- request.auth.ssl.cert_key_file = "spec/fixtures/client_key.pem"
106
-
107
- response = HTTPI.get(request, adapter)
108
- expect(response.body).to eq("get")
109
- end
110
-
111
- it "works with client cert and key set directly" do
112
- request = HTTPI::Request.new(@server.url)
113
-
114
- request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
115
- request.auth.ssl.cert = OpenSSL::X509::Certificate.new File.open("spec/fixtures/client_cert.pem").read
116
- request.auth.ssl.cert_key = OpenSSL::PKey.read File.open("spec/fixtures/client_key.pem").read
117
-
118
- response = HTTPI.get(request, adapter)
119
- expect(response.body).to eq("get")
26
+ describe "host, hostname" do
27
+ it "both are set" do
28
+ Excon.expects(:display_warning).never
29
+ expect(adapter.client.data).to include(host: 'example.com', hostname: 'example.com')
30
+ end
120
31
  end
121
32
  end
122
33
  end
123
-
124
34
  end
@@ -1,101 +1,28 @@
1
1
  require "spec_helper"
2
- require "integration/support/server"
3
-
4
- describe HTTPI::Adapter::HTTP do
5
-
6
- subject(:adapter) { :http }
7
-
8
- context "http requests" do
9
- before :all do
10
- @server = IntegrationServer.run
11
- end
12
-
13
- after :all do
14
- @server.stop
15
- end
16
-
17
- it "sends and receives HTTP headers" do
18
- request = HTTPI::Request.new(@server.url + "x-header")
19
- request.headers["X-Header"] = "HTTPI"
20
-
21
- response = HTTPI.get(request, adapter)
22
- expect(response.body).to include("HTTPI")
23
- end
24
-
25
- it "executes GET requests" do
26
- response = HTTPI.get(@server.url, adapter)
27
- expect(response.body).to eq("get")
28
- expect(response.headers["Content-Type"]).to eq("text/plain")
29
- end
30
-
31
- it "executes POST requests" do
32
- response = HTTPI.post(@server.url, "<some>xml</some>", adapter)
33
- expect(response.body).to eq("post")
34
- expect(response.headers["Content-Type"]).to eq("text/plain")
35
- end
36
-
37
- it "executes HEAD requests" do
38
- response = HTTPI.head(@server.url, adapter)
39
- expect(response.code).to eq(200)
40
- expect(response.headers["Content-Type"]).to eq("text/plain")
41
- end
42
-
43
- it "executes PUT requests" do
44
- response = HTTPI.put(@server.url, "<some>xml</some>", adapter)
45
- expect(response.body).to eq("put")
46
- expect(response.headers["Content-Type"]).to eq("text/plain")
47
- end
48
-
49
- it "executes DELETE requests" do
50
- response = HTTPI.delete(@server.url, adapter)
51
- expect(response.body).to eq("delete")
52
- expect(response.headers["Content-Type"]).to eq("text/plain")
53
- end
54
-
55
- it "supports basic authentication" do
56
- request = HTTPI::Request.new(@server.url + "basic-auth")
57
- request.auth.basic("admin", "secret")
58
-
59
- response = HTTPI.get(request, adapter)
60
- expect(response.body).to eq("basic-auth")
61
- end
62
-
63
- it "does not support digest authentication" do
64
- request = HTTPI::Request.new(@server.url + "digest-auth")
65
- request.auth.digest("admin", "secret")
66
-
67
- expect { HTTPI.get(request, adapter) }.
68
- to raise_error(HTTPI::NotSupportedError, /does not support HTTP digest authentication/)
69
- end
70
-
71
- it "does not support ntlm authentication" do
72
- request = HTTPI::Request.new(@server.url + "ntlm-auth")
73
- request.auth.ntlm("tester", "vReqSoafRe5O")
74
-
75
- expect { HTTPI.get(request, adapter) }.
76
- to raise_error(HTTPI::NotSupportedError, /does not support NTLM digest authentication/)
77
- end
78
- end
79
-
80
- if RUBY_PLATFORM =~ /java/
81
- pending "Puma Server complains: SSL not supported on JRuby"
82
- else
83
- context "https requests" do
84
- before :all do
85
- @server = IntegrationServer.run(:ssl => true)
86
- end
87
- after :all do
88
- @server.stop
89
- end
90
-
91
- it "works when set up properly" do
92
- request = HTTPI::Request.new(@server.url)
93
- request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
94
-
95
- response = HTTPI.get(request, adapter)
96
- expect(response.body).to eq("get")
2
+ require "httpi/adapter/http"
3
+ require "httpi/request"
4
+
5
+ begin
6
+ HTTPI::Adapter.load_adapter(:http)
7
+
8
+ describe HTTPI::Adapter::HTTP do
9
+ let(:adapter) { HTTPI::Adapter::HTTP.new(request) }
10
+ let(:request) { HTTPI::Request.new("http://example.com") }
11
+
12
+ describe "settings" do
13
+ describe "connect_timeout, read_timeout, write_timeout" do
14
+ it "are being set on the client" do
15
+ request.open_timeout = 30
16
+ request.read_timeout = 40
17
+ request.write_timeout = 50
18
+
19
+ expect(adapter.client.default_options.timeout_options).to eq(
20
+ connect_timeout: 30,
21
+ read_timeout: 40,
22
+ write_timeout: 50
23
+ )
24
+ end
97
25
  end
98
26
  end
99
27
  end
100
-
101
28
  end
@@ -100,6 +100,20 @@ describe HTTPI::Adapter::HTTPClient do
100
100
  end
101
101
  end
102
102
 
103
+ describe "send_timeout" do
104
+ it "is not set unless specified" do
105
+ httpclient.expects(:send_timeout=).never
106
+ adapter.request(:get)
107
+ end
108
+
109
+ it "is set if specified" do
110
+ request.write_timeout = 30
111
+
112
+ httpclient.expects(:send_timeout=).with(30)
113
+ adapter.request(:get)
114
+ end
115
+ end
116
+
103
117
  describe "set_auth" do
104
118
  it "is set for HTTP basic auth" do
105
119
  request.auth.basic "username", "password"
@@ -127,6 +141,13 @@ describe HTTPI::Adapter::HTTPClient do
127
141
 
128
142
  adapter.request(:get)
129
143
  end
144
+
145
+ it 'should set the ciphers if specified' do
146
+ request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
147
+ ssl_config.expects(:ciphers=).with(request.auth.ssl.ciphers)
148
+
149
+ adapter.request(:get)
150
+ end
130
151
  end
131
152
 
132
153
  context "(for SSL client auth)" do
@@ -164,6 +185,17 @@ describe HTTPI::Adapter::HTTPClient do
164
185
 
165
186
  adapter.request(:get)
166
187
  end
188
+
189
+ it 'raises error when min_version not nil' do
190
+ request.auth.ssl.min_version = :TLS1_2
191
+ expect{ adapter.request(:get) }.
192
+ to raise_error(HTTPI::NotSupportedError, 'Httpclient adapter does not support #min_version or #max_version. Please, use #ssl_version instead')
193
+ end
194
+ it 'raises error when max_version not nil' do
195
+ request.auth.ssl.max_version = :TLS1_2
196
+ expect{ adapter.request(:get) }.
197
+ to raise_error(HTTPI::NotSupportedError, 'Httpclient adapter does not support #min_version or #max_version. Please, use #ssl_version instead')
198
+ end
167
199
  end
168
200
 
169
201
  context "(for SSL client auth with a verify mode of :none with no certs provided)" do
@@ -1,96 +1,46 @@
1
1
  require "spec_helper"
2
- require "integration/support/server"
2
+ require "httpi/adapter/net_http_persistent"
3
+ require "httpi/request"
3
4
 
4
- describe HTTPI::Adapter::NetHTTPPersistent do
5
+ begin
6
+ HTTPI::Adapter.load_adapter(:net_http_persistent)
5
7
 
6
- subject(:adapter) { :net_http_persistent }
8
+ describe HTTPI::Adapter::NetHTTPPersistent do
9
+ let(:adapter) { HTTPI::Adapter::NetHTTPPersistent.new(request) }
10
+ let(:request) { HTTPI::Request.new("http://example.com") }
7
11
 
8
- context "http requests" do
9
- before :all do
10
- @server = IntegrationServer.run
11
- end
12
-
13
- after :all do
14
- @server.stop
15
- end
16
-
17
- it "sends and receives HTTP headers" do
18
- request = HTTPI::Request.new(@server.url + "x-header")
19
- request.headers["X-Header"] = "HTTPI"
20
-
21
- response = HTTPI.get(request, adapter)
22
- expect(response.body).to include("HTTPI")
23
- end
24
-
25
- it "executes GET requests" do
26
- response = HTTPI.get(@server.url, adapter)
27
- expect(response.body).to eq("get")
28
- expect(response.headers["Content-Type"]).to eq("text/plain")
29
- end
30
-
31
- it "executes POST requests" do
32
- response = HTTPI.post(@server.url, "<some>xml</some>", adapter)
33
- expect(response.body).to eq("post")
34
- expect(response.headers["Content-Type"]).to eq("text/plain")
35
- end
36
-
37
- it "executes HEAD requests" do
38
- response = HTTPI.head(@server.url, adapter)
39
- expect(response.code).to eq(200)
40
- expect(response.headers["Content-Type"]).to eq("text/plain")
41
- end
42
-
43
- it "executes PUT requests" do
44
- response = HTTPI.put(@server.url, "<some>xml</some>", adapter)
45
- expect(response.body).to eq("put")
46
- expect(response.headers["Content-Type"]).to eq("text/plain")
47
- end
48
-
49
- it "executes DELETE requests" do
50
- response = HTTPI.delete(@server.url, adapter)
51
- expect(response.body).to eq("delete")
52
- expect(response.headers["Content-Type"]).to eq("text/plain")
53
- end
54
-
55
- it "supports basic authentication" do
56
- request = HTTPI::Request.new(@server.url + "basic-auth")
57
- request.auth.basic("admin", "secret")
12
+ let(:response) {
13
+ Object.new.tap do |r|
14
+ r.stubs(:code).returns(200)
15
+ r.stubs(:body).returns("abc")
16
+ r.stubs(:to_hash).returns({"Content-Length" => "3"})
17
+ end
18
+ }
58
19
 
59
- response = HTTPI.get(request, adapter)
60
- expect(response.body).to eq("basic-auth")
20
+ before do
21
+ Net::HTTP::Persistent.any_instance.stubs(:start).returns(response)
61
22
  end
62
23
 
63
- it "does not support ntlm authentication" do
64
- request = HTTPI::Request.new(@server.url + "ntlm-auth")
65
- request.auth.ntlm("tester", "vReqSoafRe5O")
24
+ describe "settings" do
25
+ describe "open_timeout, read_timeout" do
26
+ it "are being set on the client" do
27
+ request.open_timeout = 30
28
+ request.read_timeout = 40
66
29
 
67
- expect { HTTPI.get(request, adapter) }.
68
- to raise_error(HTTPI::NotSupportedError, /does not support NTLM authentication/)
69
- end
70
- end
71
-
72
- # it does not support digest auth
30
+ adapter.client.expects(:open_timeout=).with(30)
31
+ adapter.client.expects(:read_timeout=).with(40)
73
32
 
74
- if RUBY_PLATFORM =~ /java/
75
- pending "Puma Server complains: SSL not supported on JRuby"
76
- else
77
- context "https requests" do
78
- before :all do
79
- @server = IntegrationServer.run(:ssl => true)
33
+ adapter.request(:get)
34
+ end
80
35
  end
81
- after :all do
82
- @server.stop
83
- end
84
-
85
- # it does not raise when no certificate was set up
86
- it "works when set up properly" do
87
- request = HTTPI::Request.new(@server.url)
88
- request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
89
36
 
90
- response = HTTPI.get(request, adapter)
91
- expect(response.body).to eq("get")
37
+ describe "write_timeout" do
38
+ it "is not supported" do
39
+ request.write_timeout = 50
40
+ expect { adapter.request(:get) }
41
+ .to raise_error(HTTPI::NotSupportedError, /write_timeout/)
42
+ end
92
43
  end
93
44
  end
94
45
  end
95
-
96
46
  end