File tree Expand file tree Collapse file tree 5 files changed +49
-1
lines changed
Expand file tree Collapse file tree 5 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 22
33* [ #336 ] ( https://github.com/slack-ruby/slack-ruby-client/pull/336 ) : Fix: handle nil events - [ @pyama86 ] ( https://github.com/pyama86 ) .
44* [ #339 ] ( https://github.com/slack-ruby/slack-ruby-client/pull/339 ) : Fix: ` channel_not_found ` resolving channel IDs with 100+ channels - [ @dblock ] ( https://github.com/dblock ) .
5+ * [ #340 ] ( https://github.com/slack-ruby/slack-ruby-client/pull/340 ) : Added ` adapter ` configuration setting to change the ` Faraday ` HTTP adapter - [ @watsonjon ] ( https://github.com/watsonjon ) .
56* Your contribution here.
67
78### 0.15.0 (2020/7/26)
Original file line number Diff line number Diff line change @@ -240,6 +240,7 @@ timeout | Optional open/read timeout in seconds.
240240open_timeout | Optional connection open timeout in seconds.
241241default_page_size | Optional page size for paginated requests, default is _ 100_ .
242242default_max_retries | Optional number of retries for paginated requests, default is _ 100_ .
243+ adapter | Optional HTTP adapter to use, defaults to ` Faraday.default_adapter ` .
243244
244245You can also pass request options, including ` timeout ` and ` open_timeout ` into individual calls.
245246
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ module Config
1616 open_timeout
1717 default_page_size
1818 default_max_retries
19+ adapter
1920 ] . freeze
2021
2122 attr_accessor ( *Config ::ATTRIBUTES )
@@ -32,6 +33,7 @@ def reset
3233 self . open_timeout = nil
3334 self . default_page_size = 100
3435 self . default_max_retries = 100
36+ self . adapter = ::Faraday . default_adapter
3537 end
3638 end
3739
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def connection
2929 connection . use ::FaradayMiddleware ::Mashify , mash_class : Slack ::Messages ::Message
3030 connection . use ::FaradayMiddleware ::ParseJson
3131 connection . response :logger , logger if logger
32- connection . adapter :: Faraday . default_adapter
32+ connection . adapter adapter
3333 end
3434 end
3535 end
Original file line number Diff line number Diff line change 150150 end
151151 end
152152
153+ context 'adapter option' do
154+ let ( :adapter ) { Faraday . default_adapter }
155+ let ( :adapter_class ) { Faraday ::Adapter ::NetHttp }
156+
157+ around do |ex |
158+ previous_adapter = Faraday . default_adapter
159+ # ensure default adapter is set for this spec
160+ Faraday . default_adapter = :net_http
161+ ex . run
162+ Faraday . default_adapter = previous_adapter
163+ end
164+
165+ context 'default adapter' do
166+ describe '#initialize' do
167+ it 'sets adapter' do
168+ expect ( client . adapter ) . to eq adapter
169+ end
170+ it 'creates a connection with an adapter' do
171+ expect ( client . send ( :connection ) . adapter ) . to eq adapter_class
172+ end
173+ end
174+ end
175+
176+ context 'non default adapter' do
177+ let ( :adapter ) { :typhoeus }
178+ let ( :adapter_class ) { Faraday ::Adapter ::Typhoeus }
179+
180+ before do
181+ described_class . configure do |config |
182+ config . adapter = adapter
183+ end
184+ end
185+
186+ describe '#initialize' do
187+ it 'sets adapter' do
188+ expect ( client . adapter ) . to eq adapter
189+ end
190+ it 'creates a connection with an adapter' do
191+ expect ( client . send ( :connection ) . adapter ) . to eq adapter_class
192+ end
193+ end
194+ end
195+ end
196+
153197 context 'timeout options' do
154198 before do
155199 described_class . configure do |config |
You can’t perform that action at this time.
0 commit comments