faraday 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -3
- data/README.md +0 -5
- data/examples/client_spec.rb +18 -18
- data/examples/client_test.rb +21 -21
- data/lib/faraday/connection.rb +7 -7
- data/lib/faraday/middleware_registry.rb +19 -1
- data/lib/faraday/rack_builder.rb +1 -1
- data/lib/faraday/version.rb +1 -1
- data/spec/faraday/connection_spec.rb +35 -35
- data/spec/faraday/middleware_registry_spec.rb +31 -0
- data/spec/faraday/rack_builder_spec.rb +0 -12
- data/spec/faraday/request_spec.rb +4 -4
- data/spec/faraday/utils/headers_spec.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eaa5f5a3ea91b21a40ad7872a8eda558226e1d5f4d8f9875ecf9ece44e0181e4
|
|
4
|
+
data.tar.gz: 51af319bffd649b4b828cfed91b2a419211b1c2b171a3016949388b1a749c1ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b68ff300b45dbe3a7f85ab40f7a23c86b2c373a1672841a96230179f415da3f3bcf2123251235c4399575826043f7221fe81615171fbfd3af4d33a21410f8670
|
|
7
|
+
data.tar.gz: 41cd332afaf70ea6e306247b3f2ea9d9e38ed248e381aef798f914773b1dd7c7473ab9a6fcb5e03cb8e7163c0f81f26e813877bb5f7412964e55ddb9866ffe20
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# Faraday Changelog
|
|
2
2
|
|
|
3
|
+
## The changelog has moved!
|
|
4
|
+
|
|
5
|
+
This file is not being updated anymore. Instead, please check the [Releases](https://github.com/lostisland/faraday/releases) page.
|
|
6
|
+
|
|
7
|
+
## [2.1.0](https://github.com/lostisland/faraday/compare/v2.0.1...v2.1.0) (2022-01-15)
|
|
8
|
+
|
|
9
|
+
* Fix test adapter thread safety by @iMacTia in [#1380](https://github.com/lostisland/faraday/pull/1380)
|
|
10
|
+
* Add default adapter options by @hirasawayuki in [#1382](https://github.com/lostisland/faraday/pull/1382)
|
|
11
|
+
* CI: Add Ruby 3.1 to matrix by @petergoldstein in [#1374](https://github.com/lostisland/faraday/pull/1374)
|
|
12
|
+
* docs: fix regex pattern in logger.md examples by @hirasawayuki in [#1378](https://github.com/lostisland/faraday/pull/1378)
|
|
13
|
+
|
|
14
|
+
## [2.0.1](https://github.com/lostisland/faraday/compare/v2.0.0...v2.0.1) (2022-01-05)
|
|
15
|
+
|
|
16
|
+
* Re-add `faraday-net_http` as default adapter by @iMacTia in [#1366](https://github.com/lostisland/faraday/pull/1366)
|
|
17
|
+
* Updated sample format in UPGRADING.md by @vimutter in [#1361](https://github.com/lostisland/faraday/pull/1361)
|
|
18
|
+
* docs: Make UPGRADING examples more copyable by @olleolleolle in [#1363](https://github.com/lostisland/faraday/pull/1363)
|
|
19
|
+
|
|
20
|
+
## [2.0.0](https://github.com/lostisland/faraday/compare/v1.8.0...v2.0.0) (2022-01-04)
|
|
21
|
+
|
|
22
|
+
The next major release is here, and it comes almost 2 years after the release of v1.0!
|
|
23
|
+
|
|
24
|
+
This release changes the way you use Faraday and embraces a new paradigm of Faraday as an ecosystem, rather than a library.
|
|
25
|
+
|
|
26
|
+
What does that mean? It means that Faraday is less of a bundled tool and more of a framework for the community to build on top of.
|
|
27
|
+
|
|
28
|
+
As a result, all adapters and some middleware have moved out and are now shipped as standalone gems 🙌!
|
|
29
|
+
|
|
30
|
+
But this doesn't mean that upgrading from Faraday 1.x to Faraday 2.0 should be hard, in fact we've listed everything you need to do in the [UPGRADING.md](https://github.com/lostisland/faraday/blob/main/UPGRADING.md) doc.
|
|
31
|
+
|
|
32
|
+
Moreover, we've setup a new [awesome-faraday](https://github.com/lostisland/awesome-faraday) repository that will showcase a curated list of adapters and middleware 😎.
|
|
33
|
+
|
|
34
|
+
This release was the result of the efforts of the core team and all the contributors, new and old, that have helped achieve this milestone 👏.
|
|
35
|
+
|
|
36
|
+
## What's Changed
|
|
37
|
+
|
|
38
|
+
* Autoloading, dependency loading and middleware registry cleanup by @iMacTia in [#1301](https://github.com/lostisland/faraday/pull/1301)
|
|
39
|
+
* Move JSON middleware (request and response) from faraday_middleware by @iMacTia in [#1300](https://github.com/lostisland/faraday/pull/1300)
|
|
40
|
+
* Remove deprecated `Faraday::Request#method` by @olleolleolle in [#1303](https://github.com/lostisland/faraday/pull/1303)
|
|
41
|
+
* Remove deprecated `Faraday::UploadIO` by @iMacTia in [#1307](https://github.com/lostisland/faraday/pull/1307)
|
|
42
|
+
* [1.x] Deprecate Authorization helpers in `Faraday::Connection` by @iMacTia in [#1306](https://github.com/lostisland/faraday/pull/1306)
|
|
43
|
+
* Drop deprecated auth helpers from Connection and refactor auth middleware by @iMacTia in [#1308](https://github.com/lostisland/faraday/pull/1308)
|
|
44
|
+
* Add Faraday 1.x examples in authentication.md docs by @iMacTia in [#1320](https://github.com/lostisland/faraday/pull/1320)
|
|
45
|
+
* Fix passing a URL with embedded basic auth by @iMacTia in [#1324](https://github.com/lostisland/faraday/pull/1324)
|
|
46
|
+
* Register JSON middleware by @mollerhoj in [#1331](https://github.com/lostisland/faraday/pull/1331)
|
|
47
|
+
* Retry middleware should handle string exception class name consistently by @jrochkind in [#1334](https://github.com/lostisland/faraday/pull/1334)
|
|
48
|
+
* Improve request info in exceptions raised by RaiseError Middleware by @willianzocolau in [#1335](https://github.com/lostisland/faraday/pull/1335)
|
|
49
|
+
* Remove net-http adapter and update docs by @iMacTia in [#1336](https://github.com/lostisland/faraday/pull/1336)
|
|
50
|
+
* Explain plan for faraday_middleware in UPGRADING.md by @iMacTia in [#1339](https://github.com/lostisland/faraday/pull/1339)
|
|
51
|
+
* Scripts folder cleanup by @iMacTia in [#1340](https://github.com/lostisland/faraday/pull/1340)
|
|
52
|
+
* Replace `Hash#merge` with `Utils#deep_merge` for connection options by @xkwd in [#1343](https://github.com/lostisland/faraday/pull/1343)
|
|
53
|
+
* Callable authorizers by @sled in [#1345](https://github.com/lostisland/faraday/pull/1345)
|
|
54
|
+
* Default value for exc error by @DariuszMusielak in [#1351](https://github.com/lostisland/faraday/pull/1351)
|
|
55
|
+
* Don't call `retry_block` unless a retry is going to happen by @jrochkind in [#1350](https://github.com/lostisland/faraday/pull/1350)
|
|
56
|
+
* Improve documentation for v2 by @iMacTia in [#1353](https://github.com/lostisland/faraday/pull/1353)
|
|
57
|
+
* Remove default `default_adapter` (yes, you read that right) by @iMacTia in [#1354](https://github.com/lostisland/faraday/pull/1354)
|
|
58
|
+
* Remove retry middleware by @iMacTia in [#1356](https://github.com/lostisland/faraday/pull/1356)
|
|
59
|
+
* Remove multipart middleware and all its documentation and tests by @iMacTia in [#1357](https://github.com/lostisland/faraday/pull/1357)
|
|
60
|
+
|
|
61
|
+
## [1.9.3](https://github.com/lostisland/faraday/compare/v1.9.2...v1.9.3) (2022-01-06)
|
|
62
|
+
|
|
63
|
+
* Re-add support for Ruby 2.4+ by @iMacTia in [#1371](https://github.com/lostisland/faraday/pull/1371)
|
|
64
|
+
|
|
65
|
+
## [1.9.2](https://github.com/lostisland/faraday/compare/v1.9.1...v1.9.2) (2022-01-06)
|
|
66
|
+
|
|
67
|
+
* Add alias with legacy name to gemified middleware by @iMacTia in [#1372](https://github.com/lostisland/faraday/pull/1372)
|
|
68
|
+
|
|
69
|
+
## [1.9.1](https://github.com/lostisland/faraday/compare/v1.9.0...v1.9.1) (2022-01-06)
|
|
70
|
+
|
|
71
|
+
* Update adapter dependencies in Gemspec by @iMacTia in [#1370](https://github.com/lostisland/faraday/pull/1370)
|
|
72
|
+
|
|
73
|
+
## [1.9.0](https://github.com/lostisland/faraday/compare/v1.8.0...v1.9.0) (2022-01-06)
|
|
74
|
+
|
|
75
|
+
* Use external multipart and retry middleware by @iMacTia in [#1367](https://github.com/lostisland/faraday/pull/1367)
|
|
76
|
+
|
|
3
77
|
## [1.8.0](https://github.com/lostisland/faraday/releases/tag/v1.8.0) (2021-09-18)
|
|
4
78
|
|
|
5
79
|
### Features
|
|
@@ -65,7 +139,7 @@
|
|
|
65
139
|
|
|
66
140
|
### Highlights
|
|
67
141
|
|
|
68
|
-
With this release, we continue the work of gradually moving out adapters into their own gems 🎉
|
|
142
|
+
With this release, we continue the work of gradually moving out adapters into their own gems 🎉
|
|
69
143
|
Thanks to @MikeRogers0 for helping the Faraday team in progressing with this quest 👏
|
|
70
144
|
|
|
71
145
|
And thanks to @olleolleolle efforts, Faraday is becoming more inclusive than ever 🤗
|
|
@@ -112,7 +186,7 @@ Checkout the "Misc" section below for more details 🙌 !
|
|
|
112
186
|
## [v1.3.0](https://github.com/lostisland/faraday/releases/tag/v1.3.0) (2020-12-31)
|
|
113
187
|
|
|
114
188
|
### Highlights
|
|
115
|
-
Faraday v1.3.0 is the first release to officially support Ruby 3.0 in the CI pipeline 🎉 🍾!
|
|
189
|
+
Faraday v1.3.0 is the first release to officially support Ruby 3.0 in the CI pipeline 🎉 🍾!
|
|
116
190
|
|
|
117
191
|
This is also the first release with a previously "included" adapter (Net::HTTP) being isolated into a [separate gem](https://github.com/lostisland/faraday-net_http) 🎊!
|
|
118
192
|
The new adapter is added to Faraday as a dependency for now, so that means full backwards-compatibility, but just to be safe be careful when upgrading!
|
|
@@ -203,7 +277,7 @@ Many thanks to the Faraday Team, @JanDintel and everyone who attended the [ROSS
|
|
|
203
277
|
* Allows `parse` method to be private/protected in response middleware (#1123)
|
|
204
278
|
* Encode Spaces in Query Strings as '%20' Instead of '+' (#1125)
|
|
205
279
|
* Limits rack to v2.0.x (#1127)
|
|
206
|
-
* Adapter Registry reads also use mutex (#1136)
|
|
280
|
+
* Adapter Registry reads also use mutex (#1136)
|
|
207
281
|
|
|
208
282
|
### Documentation
|
|
209
283
|
|
data/README.md
CHANGED
|
@@ -10,11 +10,6 @@ adapters (such as Net::HTTP) and embraces the concept of Rack middleware when pr
|
|
|
10
10
|
You probably don't want to use Faraday directly in your project, as it will lack an actual client library to perform
|
|
11
11
|
requests. Instead, you probably want to have a look at [Awesome Faraday][awesome] for a list of available adapters.
|
|
12
12
|
|
|
13
|
-
## FARADAY 2.0
|
|
14
|
-
|
|
15
|
-
You're reading the README and looking at the code of our upcoming v2.0 release (the `main` branch, currently in alpha).
|
|
16
|
-
If you're here to read about our latest v1.x release, then please head over to the [1.x branch](https://github.com/lostisland/faraday/tree/1.x).
|
|
17
|
-
|
|
18
13
|
## Getting Started
|
|
19
14
|
|
|
20
15
|
The best starting point is the [Faraday Website][website], with its introduction and explanation.
|
data/examples/client_spec.rb
CHANGED
|
@@ -12,10 +12,10 @@ class Client
|
|
|
12
12
|
@conn = conn
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def
|
|
15
|
+
def httpbingo(jname, params: {})
|
|
16
16
|
res = @conn.get("/#{jname}", params)
|
|
17
17
|
data = JSON.parse(res.body)
|
|
18
|
-
data['
|
|
18
|
+
data['origin']
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -24,42 +24,42 @@ RSpec.describe Client do
|
|
|
24
24
|
let(:conn) { Faraday.new { |b| b.adapter(:test, stubs) } }
|
|
25
25
|
let(:client) { Client.new(conn) }
|
|
26
26
|
|
|
27
|
-
it 'parses
|
|
28
|
-
stubs.get('/
|
|
27
|
+
it 'parses origin' do
|
|
28
|
+
stubs.get('/ip') do |env|
|
|
29
29
|
# optional: you can inspect the Faraday::Env
|
|
30
|
-
expect(env.url.path).to eq('/
|
|
30
|
+
expect(env.url.path).to eq('/ip')
|
|
31
31
|
[
|
|
32
32
|
200,
|
|
33
33
|
{ 'Content-Type': 'application/javascript' },
|
|
34
|
-
'{"
|
|
34
|
+
'{"origin": "127.0.0.1"}'
|
|
35
35
|
]
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
# uncomment to trigger stubs.verify_stubbed_calls failure
|
|
39
39
|
# stubs.get('/unused') { [404, {}, ''] }
|
|
40
40
|
|
|
41
|
-
expect(client.
|
|
41
|
+
expect(client.httpbingo('ip')).to eq('127.0.0.1')
|
|
42
42
|
stubs.verify_stubbed_calls
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it 'handles 404' do
|
|
46
|
-
stubs.get('/
|
|
46
|
+
stubs.get('/api') do
|
|
47
47
|
[
|
|
48
48
|
404,
|
|
49
49
|
{ 'Content-Type': 'application/javascript' },
|
|
50
50
|
'{}'
|
|
51
51
|
]
|
|
52
52
|
end
|
|
53
|
-
expect(client.
|
|
53
|
+
expect(client.httpbingo('api')).to be_nil
|
|
54
54
|
stubs.verify_stubbed_calls
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it 'handles exception' do
|
|
58
|
-
stubs.get('/
|
|
58
|
+
stubs.get('/api') do
|
|
59
59
|
raise Faraday::ConnectionFailed
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
expect { client.
|
|
62
|
+
expect { client.httpbingo('api') }.to raise_error(Faraday::ConnectionFailed)
|
|
63
63
|
stubs.verify_stubbed_calls
|
|
64
64
|
end
|
|
65
65
|
|
|
@@ -67,17 +67,17 @@ RSpec.describe Client do
|
|
|
67
67
|
let(:stubs) { Faraday::Adapter::Test::Stubs.new(strict_mode: true) }
|
|
68
68
|
|
|
69
69
|
it 'verifies the all parameter values are identical' do
|
|
70
|
-
stubs.get('/
|
|
70
|
+
stubs.get('/api?abc=123') do
|
|
71
71
|
[
|
|
72
72
|
200,
|
|
73
73
|
{ 'Content-Type': 'application/javascript' },
|
|
74
|
-
'{"
|
|
74
|
+
'{"origin": "127.0.0.1"}'
|
|
75
75
|
]
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
# uncomment to raise Stubs::NotFound
|
|
79
|
-
# expect(client.
|
|
80
|
-
expect(client.
|
|
79
|
+
# expect(client.httpbingo('api', params: { abc: 123, foo: 'Kappa' })).to eq('127.0.0.1')
|
|
80
|
+
expect(client.httpbingo('api', params: { abc: 123 })).to eq('127.0.0.1')
|
|
81
81
|
stubs.verify_stubbed_calls
|
|
82
82
|
end
|
|
83
83
|
end
|
|
@@ -86,11 +86,11 @@ RSpec.describe Client do
|
|
|
86
86
|
let(:conn) { Faraday.new(request: { params_encoder: Faraday::FlatParamsEncoder }) { |b| b.adapter(:test, stubs) } }
|
|
87
87
|
|
|
88
88
|
it 'handles the same multiple URL parameters' do
|
|
89
|
-
stubs.get('/
|
|
89
|
+
stubs.get('/api?a=x&a=y&a=z') { [200, { 'Content-Type' => 'application/json' }, '{"origin": "127.0.0.1"}'] }
|
|
90
90
|
|
|
91
91
|
# uncomment to raise Stubs::NotFound
|
|
92
|
-
# expect(client.
|
|
93
|
-
expect(client.
|
|
92
|
+
# expect(client.httpbingo('api', params: { a: %w[x y] })).to eq('127.0.0.1')
|
|
93
|
+
expect(client.httpbingo('api', params: { a: %w[x y z] })).to eq('127.0.0.1')
|
|
94
94
|
stubs.verify_stubbed_calls
|
|
95
95
|
end
|
|
96
96
|
end
|
data/examples/client_test.rb
CHANGED
|
@@ -13,24 +13,24 @@ class Client
|
|
|
13
13
|
@conn = conn
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def
|
|
16
|
+
def httpbingo(jname, params: {})
|
|
17
17
|
res = @conn.get("/#{jname}", params)
|
|
18
18
|
data = JSON.parse(res.body)
|
|
19
|
-
data['
|
|
19
|
+
data['origin']
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
# Example API client test
|
|
24
24
|
class ClientTest < Test::Unit::TestCase
|
|
25
|
-
def
|
|
25
|
+
def test_httpbingo_name
|
|
26
26
|
stubs = Faraday::Adapter::Test::Stubs.new
|
|
27
|
-
stubs.get('/
|
|
27
|
+
stubs.get('/api') do |env|
|
|
28
28
|
# optional: you can inspect the Faraday::Env
|
|
29
|
-
assert_equal '/
|
|
29
|
+
assert_equal '/api', env.url.path
|
|
30
30
|
[
|
|
31
31
|
200,
|
|
32
32
|
{ 'Content-Type': 'application/javascript' },
|
|
33
|
-
'{"
|
|
33
|
+
'{"origin": "127.0.0.1"}'
|
|
34
34
|
]
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -38,13 +38,13 @@ class ClientTest < Test::Unit::TestCase
|
|
|
38
38
|
# stubs.get('/unused') { [404, {}, ''] }
|
|
39
39
|
|
|
40
40
|
cli = client(stubs)
|
|
41
|
-
assert_equal '
|
|
41
|
+
assert_equal '127.0.0.1', cli.httpbingo('api')
|
|
42
42
|
stubs.verify_stubbed_calls
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def
|
|
45
|
+
def test_httpbingo_not_found
|
|
46
46
|
stubs = Faraday::Adapter::Test::Stubs.new
|
|
47
|
-
stubs.get('/
|
|
47
|
+
stubs.get('/api') do
|
|
48
48
|
[
|
|
49
49
|
404,
|
|
50
50
|
{ 'Content-Type': 'application/javascript' },
|
|
@@ -53,48 +53,48 @@ class ClientTest < Test::Unit::TestCase
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
cli = client(stubs)
|
|
56
|
-
assert_nil cli.
|
|
56
|
+
assert_nil cli.httpbingo('api')
|
|
57
57
|
stubs.verify_stubbed_calls
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
def
|
|
60
|
+
def test_httpbingo_exception
|
|
61
61
|
stubs = Faraday::Adapter::Test::Stubs.new
|
|
62
|
-
stubs.get('/
|
|
62
|
+
stubs.get('/api') do
|
|
63
63
|
raise Faraday::ConnectionFailed
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
cli = client(stubs)
|
|
67
67
|
assert_raise Faraday::ConnectionFailed do
|
|
68
|
-
cli.
|
|
68
|
+
cli.httpbingo('api')
|
|
69
69
|
end
|
|
70
70
|
stubs.verify_stubbed_calls
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def test_strict_mode
|
|
74
74
|
stubs = Faraday::Adapter::Test::Stubs.new(strict_mode: true)
|
|
75
|
-
stubs.get('/
|
|
75
|
+
stubs.get('/api?abc=123') do
|
|
76
76
|
[
|
|
77
77
|
200,
|
|
78
78
|
{ 'Content-Type': 'application/javascript' },
|
|
79
|
-
'{"
|
|
79
|
+
'{"origin": "127.0.0.1"}'
|
|
80
80
|
]
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
cli = client(stubs)
|
|
84
|
-
assert_equal '
|
|
84
|
+
assert_equal '127.0.0.1', cli.httpbingo('api', params: { abc: 123 })
|
|
85
85
|
|
|
86
86
|
# uncomment to raise Stubs::NotFound
|
|
87
|
-
# assert_equal '
|
|
87
|
+
# assert_equal '127.0.0.1', cli.httpbingo('api', params: { abc: 123, foo: 'Kappa' })
|
|
88
88
|
stubs.verify_stubbed_calls
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def test_non_default_params_encoder
|
|
92
92
|
stubs = Faraday::Adapter::Test::Stubs.new(strict_mode: true)
|
|
93
|
-
stubs.get('/
|
|
93
|
+
stubs.get('/api?a=x&a=y&a=z') do
|
|
94
94
|
[
|
|
95
95
|
200,
|
|
96
96
|
{ 'Content-Type': 'application/javascript' },
|
|
97
|
-
'{"
|
|
97
|
+
'{"origin": "127.0.0.1"}'
|
|
98
98
|
]
|
|
99
99
|
end
|
|
100
100
|
conn = Faraday.new(request: { params_encoder: Faraday::FlatParamsEncoder }) do |builder|
|
|
@@ -102,10 +102,10 @@ class ClientTest < Test::Unit::TestCase
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
cli = Client.new(conn)
|
|
105
|
-
assert_equal '
|
|
105
|
+
assert_equal '127.0.0.1', cli.httpbingo('api', params: { a: %w[x y z] })
|
|
106
106
|
|
|
107
107
|
# uncomment to raise Stubs::NotFound
|
|
108
|
-
# assert_equal '
|
|
108
|
+
# assert_equal '127.0.0.1', cli.httpbingo('api', params: { a: %w[x y] })
|
|
109
109
|
stubs.verify_stubbed_calls
|
|
110
110
|
end
|
|
111
111
|
|
data/lib/faraday/connection.rb
CHANGED
|
@@ -6,9 +6,9 @@ module Faraday
|
|
|
6
6
|
#
|
|
7
7
|
# @example
|
|
8
8
|
#
|
|
9
|
-
# conn = Faraday::Connection.new 'http://
|
|
9
|
+
# conn = Faraday::Connection.new 'http://httpbingo.org'
|
|
10
10
|
#
|
|
11
|
-
# # GET http://
|
|
11
|
+
# # GET http://httpbingo.org/nigiri
|
|
12
12
|
# conn.get 'nigiri'
|
|
13
13
|
# # => #<Faraday::Response>
|
|
14
14
|
#
|
|
@@ -349,11 +349,11 @@ module Faraday
|
|
|
349
349
|
# @example
|
|
350
350
|
#
|
|
351
351
|
# conn = Faraday::Connection.new { ... }
|
|
352
|
-
# conn.url_prefix = "https://
|
|
352
|
+
# conn.url_prefix = "https://httpbingo.org/api"
|
|
353
353
|
# conn.scheme # => https
|
|
354
354
|
# conn.path_prefix # => "/api"
|
|
355
355
|
#
|
|
356
|
-
# conn.get("nigiri?page=2") # accesses https://
|
|
356
|
+
# conn.get("nigiri?page=2") # accesses https://httpbingo.org/api/nigiri
|
|
357
357
|
def url_prefix=(url, encoder = nil)
|
|
358
358
|
uri = @url_prefix = Utils.URI(url)
|
|
359
359
|
self.path_prefix = uri.path
|
|
@@ -395,15 +395,15 @@ module Faraday
|
|
|
395
395
|
#
|
|
396
396
|
# @example
|
|
397
397
|
# conn = Faraday::Connection.new { ... }
|
|
398
|
-
# conn.url_prefix = "https://
|
|
398
|
+
# conn.url_prefix = "https://httpbingo.org/api?token=abc"
|
|
399
399
|
# conn.scheme # => https
|
|
400
400
|
# conn.path_prefix # => "/api"
|
|
401
401
|
#
|
|
402
402
|
# conn.build_url("nigiri?page=2")
|
|
403
|
-
# # => https://
|
|
403
|
+
# # => https://httpbingo.org/api/nigiri?token=abc&page=2
|
|
404
404
|
#
|
|
405
405
|
# conn.build_url("nigiri", page: 2)
|
|
406
|
-
# # => https://
|
|
406
|
+
# # => https://httpbingo.org/api/nigiri?token=abc&page=2
|
|
407
407
|
#
|
|
408
408
|
def build_url(url = nil, extra_params = nil)
|
|
409
409
|
uri = build_exclusive_url(url)
|
|
@@ -53,13 +53,31 @@ module Faraday
|
|
|
53
53
|
# Faraday::Middleware.lookup_middleware(:foo)
|
|
54
54
|
# # => Faraday::Whatever
|
|
55
55
|
def lookup_middleware(key)
|
|
56
|
-
|
|
56
|
+
load_middleware(key) ||
|
|
57
57
|
raise(Faraday::Error, "#{key.inspect} is not registered on #{self}")
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
+
private
|
|
61
|
+
|
|
60
62
|
def middleware_mutex(&block)
|
|
61
63
|
@middleware_mutex ||= Monitor.new
|
|
62
64
|
@middleware_mutex.synchronize(&block)
|
|
63
65
|
end
|
|
66
|
+
|
|
67
|
+
def load_middleware(key)
|
|
68
|
+
value = registered_middleware[key]
|
|
69
|
+
case value
|
|
70
|
+
when Module
|
|
71
|
+
value
|
|
72
|
+
when Symbol, String
|
|
73
|
+
middleware_mutex do
|
|
74
|
+
@registered_middleware[key] = const_get(value)
|
|
75
|
+
end
|
|
76
|
+
when Proc
|
|
77
|
+
middleware_mutex do
|
|
78
|
+
@registered_middleware[key] = value.call
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
64
82
|
end
|
|
65
83
|
end
|
data/lib/faraday/rack_builder.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Faraday
|
|
|
8
8
|
# middleware stack (heavily inspired by Rack).
|
|
9
9
|
#
|
|
10
10
|
# @example
|
|
11
|
-
# Faraday::Connection.new(url: 'http://
|
|
11
|
+
# Faraday::Connection.new(url: 'http://httpbingo.org') do |builder|
|
|
12
12
|
# builder.request :url_encoded # Faraday::Request::UrlEncoded
|
|
13
13
|
# builder.adapter :net_http # Faraday::Adapter::NetHttp
|
|
14
14
|
# end
|
data/lib/faraday/version.rb
CHANGED
|
@@ -12,9 +12,9 @@ end
|
|
|
12
12
|
|
|
13
13
|
shared_examples 'initializer with url' do
|
|
14
14
|
context 'with simple url' do
|
|
15
|
-
let(:address) { 'http://
|
|
15
|
+
let(:address) { 'http://httpbingo.org' }
|
|
16
16
|
|
|
17
|
-
it { expect(subject.host).to eq('
|
|
17
|
+
it { expect(subject.host).to eq('httpbingo.org') }
|
|
18
18
|
it { expect(subject.port).to eq(80) }
|
|
19
19
|
it { expect(subject.scheme).to eq('http') }
|
|
20
20
|
it { expect(subject.path_prefix).to eq('/') }
|
|
@@ -22,7 +22,7 @@ shared_examples 'initializer with url' do
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
context 'with complex url' do
|
|
25
|
-
let(:address) { 'http://
|
|
25
|
+
let(:address) { 'http://httpbingo.org:815/fish?a=1' }
|
|
26
26
|
|
|
27
27
|
it { expect(subject.port).to eq(815) }
|
|
28
28
|
it { expect(subject.path_prefix).to eq('/fish') }
|
|
@@ -41,17 +41,17 @@ shared_examples 'default connection options' do
|
|
|
41
41
|
after { Faraday.default_connection_options = nil }
|
|
42
42
|
|
|
43
43
|
it 'works with implicit url' do
|
|
44
|
-
conn = Faraday.new 'http://
|
|
44
|
+
conn = Faraday.new 'http://httpbingo.org/foo'
|
|
45
45
|
expect(conn.options.timeout).to eq(10)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
it 'works with option url' do
|
|
49
|
-
conn = Faraday.new url: 'http://
|
|
49
|
+
conn = Faraday.new url: 'http://httpbingo.org/foo'
|
|
50
50
|
expect(conn.options.timeout).to eq(10)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
it 'works with instance connection options' do
|
|
54
|
-
conn = Faraday.new 'http://
|
|
54
|
+
conn = Faraday.new 'http://httpbingo.org/foo', request: { open_timeout: 1 }
|
|
55
55
|
expect(conn.options.timeout).to eq(10)
|
|
56
56
|
expect(conn.options.open_timeout).to eq(1)
|
|
57
57
|
end
|
|
@@ -61,7 +61,7 @@ shared_examples 'default connection options' do
|
|
|
61
61
|
conn.options.timeout = 1
|
|
62
62
|
expect(Faraday.default_connection_options.request.timeout).to eq(10)
|
|
63
63
|
|
|
64
|
-
other = Faraday.new url: 'https://
|
|
64
|
+
other = Faraday.new url: 'https://httpbingo.org/foo'
|
|
65
65
|
other.options.timeout = 1
|
|
66
66
|
|
|
67
67
|
expect(Faraday.default_connection_options.request.timeout).to eq(10)
|
|
@@ -81,14 +81,14 @@ RSpec.describe Faraday::Connection do
|
|
|
81
81
|
subject { conn }
|
|
82
82
|
|
|
83
83
|
context 'with implicit url param' do
|
|
84
|
-
# Faraday::Connection.new('http://
|
|
84
|
+
# Faraday::Connection.new('http://httpbingo.org')
|
|
85
85
|
let(:url) { address }
|
|
86
86
|
|
|
87
87
|
it_behaves_like 'initializer with url'
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
context 'with explicit url param' do
|
|
91
|
-
# Faraday::Connection.new(url: 'http://
|
|
91
|
+
# Faraday::Connection.new(url: 'http://httpbingo.org')
|
|
92
92
|
let(:url) { { url: address } }
|
|
93
93
|
|
|
94
94
|
it_behaves_like 'initializer with url'
|
|
@@ -108,13 +108,13 @@ RSpec.describe Faraday::Connection do
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
context 'with custom params and params in url' do
|
|
111
|
-
let(:url) { 'http://
|
|
111
|
+
let(:url) { 'http://httpbingo.org/fish?a=1&b=2' }
|
|
112
112
|
let(:options) { { params: { a: 3 } } }
|
|
113
113
|
it { expect(subject.params).to eq('a' => 3, 'b' => '2') }
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
context 'with basic_auth in url' do
|
|
117
|
-
let(:url) { 'http://Aladdin:open%20sesame@
|
|
117
|
+
let(:url) { 'http://Aladdin:open%20sesame@httpbingo.org/fish' }
|
|
118
118
|
|
|
119
119
|
it { expect(subject.headers['Authorization']).to eq('Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==') }
|
|
120
120
|
end
|
|
@@ -141,7 +141,7 @@ RSpec.describe Faraday::Connection do
|
|
|
141
141
|
let(:conn) do
|
|
142
142
|
Faraday::Connection.new(params: { 'a' => '1' }) do |faraday|
|
|
143
143
|
faraday.adapter :test
|
|
144
|
-
faraday.url_prefix = 'http://
|
|
144
|
+
faraday.url_prefix = 'http://httpbingo.org/omnom'
|
|
145
145
|
end
|
|
146
146
|
end
|
|
147
147
|
|
|
@@ -165,8 +165,8 @@ RSpec.describe Faraday::Connection do
|
|
|
165
165
|
subject { conn.build_exclusive_url('sake.html') }
|
|
166
166
|
|
|
167
167
|
it 'uses connection host as default host' do
|
|
168
|
-
conn.host = '
|
|
169
|
-
expect(subject.host).to eq('
|
|
168
|
+
conn.host = 'httpbingo.org'
|
|
169
|
+
expect(subject.host).to eq('httpbingo.org')
|
|
170
170
|
expect(subject.scheme).to eq('http')
|
|
171
171
|
end
|
|
172
172
|
|
|
@@ -203,10 +203,10 @@ RSpec.describe Faraday::Connection do
|
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
context 'with complete url' do
|
|
206
|
-
subject { conn.build_exclusive_url('http://
|
|
206
|
+
subject { conn.build_exclusive_url('http://httpbingo.org/sake.html?a=1') }
|
|
207
207
|
|
|
208
208
|
it { expect(subject.scheme).to eq('http') }
|
|
209
|
-
it { expect(subject.host).to eq('
|
|
209
|
+
it { expect(subject.host).to eq('httpbingo.org') }
|
|
210
210
|
it { expect(subject.port).to eq(80) }
|
|
211
211
|
it { expect(subject.path).to eq('/sake.html') }
|
|
212
212
|
it { expect(subject.query).to eq('a=1') }
|
|
@@ -214,35 +214,35 @@ RSpec.describe Faraday::Connection do
|
|
|
214
214
|
|
|
215
215
|
it 'overrides connection port for absolute url' do
|
|
216
216
|
conn.port = 23
|
|
217
|
-
uri = conn.build_exclusive_url('http://
|
|
217
|
+
uri = conn.build_exclusive_url('http://httpbingo.org')
|
|
218
218
|
expect(uri.port).to eq(80)
|
|
219
219
|
end
|
|
220
220
|
|
|
221
221
|
it 'does not add ending slash given nil url' do
|
|
222
|
-
conn.url_prefix = 'http://
|
|
222
|
+
conn.url_prefix = 'http://httpbingo.org/nigiri'
|
|
223
223
|
uri = conn.build_exclusive_url
|
|
224
224
|
expect(uri.path).to eq('/nigiri')
|
|
225
225
|
end
|
|
226
226
|
|
|
227
227
|
it 'does not add ending slash given empty url' do
|
|
228
|
-
conn.url_prefix = 'http://
|
|
228
|
+
conn.url_prefix = 'http://httpbingo.org/nigiri'
|
|
229
229
|
uri = conn.build_exclusive_url('')
|
|
230
230
|
expect(uri.path).to eq('/nigiri')
|
|
231
231
|
end
|
|
232
232
|
|
|
233
233
|
it 'does not use connection params' do
|
|
234
|
-
conn.url_prefix = 'http://
|
|
234
|
+
conn.url_prefix = 'http://httpbingo.org/nigiri'
|
|
235
235
|
conn.params = { a: 1 }
|
|
236
|
-
expect(conn.build_exclusive_url.to_s).to eq('http://
|
|
236
|
+
expect(conn.build_exclusive_url.to_s).to eq('http://httpbingo.org/nigiri')
|
|
237
237
|
end
|
|
238
238
|
|
|
239
239
|
it 'allows to provide params argument' do
|
|
240
|
-
conn.url_prefix = 'http://
|
|
240
|
+
conn.url_prefix = 'http://httpbingo.org/nigiri'
|
|
241
241
|
conn.params = { a: 1 }
|
|
242
242
|
params = Faraday::Utils::ParamsHash.new
|
|
243
243
|
params[:a] = 2
|
|
244
244
|
uri = conn.build_exclusive_url(nil, params)
|
|
245
|
-
expect(uri.to_s).to eq('http://
|
|
245
|
+
expect(uri.to_s).to eq('http://httpbingo.org/nigiri?a=2')
|
|
246
246
|
end
|
|
247
247
|
|
|
248
248
|
it 'handles uri instances' do
|
|
@@ -251,34 +251,34 @@ RSpec.describe Faraday::Connection do
|
|
|
251
251
|
end
|
|
252
252
|
|
|
253
253
|
it 'always returns new URI instance' do
|
|
254
|
-
conn.url_prefix = 'http://
|
|
254
|
+
conn.url_prefix = 'http://httpbingo.org'
|
|
255
255
|
uri1 = conn.build_exclusive_url(nil)
|
|
256
256
|
uri2 = conn.build_exclusive_url(nil)
|
|
257
257
|
expect(uri1).not_to equal(uri2)
|
|
258
258
|
end
|
|
259
259
|
|
|
260
260
|
context 'with url_prefixed connection' do
|
|
261
|
-
let(:url) { 'http://
|
|
261
|
+
let(:url) { 'http://httpbingo.org/get/' }
|
|
262
262
|
|
|
263
263
|
it 'parses url and changes scheme' do
|
|
264
264
|
conn.scheme = 'https'
|
|
265
265
|
uri = conn.build_exclusive_url('sake.html')
|
|
266
|
-
expect(uri.to_s).to eq('https://
|
|
266
|
+
expect(uri.to_s).to eq('https://httpbingo.org/get/sake.html')
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
it 'joins url to base with ending slash' do
|
|
270
270
|
uri = conn.build_exclusive_url('sake.html')
|
|
271
|
-
expect(uri.to_s).to eq('http://
|
|
271
|
+
expect(uri.to_s).to eq('http://httpbingo.org/get/sake.html')
|
|
272
272
|
end
|
|
273
273
|
|
|
274
274
|
it 'used default base with ending slash' do
|
|
275
275
|
uri = conn.build_exclusive_url
|
|
276
|
-
expect(uri.to_s).to eq('http://
|
|
276
|
+
expect(uri.to_s).to eq('http://httpbingo.org/get/')
|
|
277
277
|
end
|
|
278
278
|
|
|
279
279
|
it 'overrides base' do
|
|
280
280
|
uri = conn.build_exclusive_url('/sake/')
|
|
281
|
-
expect(uri.to_s).to eq('http://
|
|
281
|
+
expect(uri.to_s).to eq('http://httpbingo.org/sake/')
|
|
282
282
|
end
|
|
283
283
|
end
|
|
284
284
|
|
|
@@ -307,22 +307,22 @@ RSpec.describe Faraday::Connection do
|
|
|
307
307
|
end
|
|
308
308
|
|
|
309
309
|
describe '#build_url' do
|
|
310
|
-
let(:url) { 'http://
|
|
310
|
+
let(:url) { 'http://httpbingo.org/nigiri' }
|
|
311
311
|
|
|
312
312
|
it 'uses params' do
|
|
313
313
|
conn.params = { a: 1, b: 1 }
|
|
314
|
-
expect(conn.build_url.to_s).to eq('http://
|
|
314
|
+
expect(conn.build_url.to_s).to eq('http://httpbingo.org/nigiri?a=1&b=1')
|
|
315
315
|
end
|
|
316
316
|
|
|
317
317
|
it 'merges params' do
|
|
318
318
|
conn.params = { a: 1, b: 1 }
|
|
319
319
|
url = conn.build_url(nil, b: 2, c: 3)
|
|
320
|
-
expect(url.to_s).to eq('http://
|
|
320
|
+
expect(url.to_s).to eq('http://httpbingo.org/nigiri?a=1&b=2&c=3')
|
|
321
321
|
end
|
|
322
322
|
end
|
|
323
323
|
|
|
324
324
|
describe '#build_request' do
|
|
325
|
-
let(:url) { 'https://
|
|
325
|
+
let(:url) { 'https://ahttpbingo.org/sake.html' }
|
|
326
326
|
let(:request) { conn.build_request(:get) }
|
|
327
327
|
|
|
328
328
|
before do
|
|
@@ -339,7 +339,7 @@ RSpec.describe Faraday::Connection do
|
|
|
339
339
|
describe '#to_env' do
|
|
340
340
|
subject { conn.build_request(:get).to_env(conn).url }
|
|
341
341
|
|
|
342
|
-
let(:url) { 'http://
|
|
342
|
+
let(:url) { 'http://httpbingo.org/sake.html' }
|
|
343
343
|
let(:options) { { params: @params } }
|
|
344
344
|
|
|
345
345
|
it 'parses url params into query' do
|
|
@@ -592,7 +592,7 @@ RSpec.describe Faraday::Connection do
|
|
|
592
592
|
describe '#dup' do
|
|
593
593
|
subject { conn.dup }
|
|
594
594
|
|
|
595
|
-
let(:url) { 'http://
|
|
595
|
+
let(:url) { 'http://httpbingo.org/foo' }
|
|
596
596
|
let(:options) do
|
|
597
597
|
{
|
|
598
598
|
ssl: { verify: :none },
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Faraday::MiddlewareRegistry do
|
|
4
|
+
before do
|
|
5
|
+
stub_const('CustomMiddleware', custom_middleware_klass)
|
|
6
|
+
end
|
|
7
|
+
let(:custom_middleware_klass) { Class.new(Faraday::Middleware) }
|
|
8
|
+
let(:dummy) { Class.new { extend Faraday::MiddlewareRegistry } }
|
|
9
|
+
|
|
10
|
+
after { dummy.unregister_middleware(:custom) }
|
|
11
|
+
|
|
12
|
+
it 'allows to register with constant' do
|
|
13
|
+
dummy.register_middleware(custom: custom_middleware_klass)
|
|
14
|
+
expect(dummy.lookup_middleware(:custom)).to eq(custom_middleware_klass)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'allows to register with symbol' do
|
|
18
|
+
dummy.register_middleware(custom: :CustomMiddleware)
|
|
19
|
+
expect(dummy.lookup_middleware(:custom)).to eq(custom_middleware_klass)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'allows to register with string' do
|
|
23
|
+
dummy.register_middleware(custom: 'CustomMiddleware')
|
|
24
|
+
expect(dummy.lookup_middleware(:custom)).to eq(custom_middleware_klass)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'allows to register with Proc' do
|
|
28
|
+
dummy.register_middleware(custom: -> { custom_middleware_klass })
|
|
29
|
+
expect(dummy.lookup_middleware(:custom)).to eq(custom_middleware_klass)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -110,18 +110,6 @@ RSpec.describe Faraday::RackBuilder do
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
context 'with custom registered middleware' do
|
|
114
|
-
let(:conn) { Faraday::Connection.new {} }
|
|
115
|
-
|
|
116
|
-
after { Faraday::Middleware.unregister_middleware(:apple) }
|
|
117
|
-
|
|
118
|
-
it 'allows to register with constant' do
|
|
119
|
-
Faraday::Middleware.register_middleware(apple: Apple)
|
|
120
|
-
subject.use(:apple)
|
|
121
|
-
expect(subject.handlers).to eq([Apple])
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
113
|
context 'when having two handlers' do
|
|
126
114
|
let(:conn) { Faraday::Connection.new {} }
|
|
127
115
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
RSpec.describe Faraday::Request do
|
|
4
4
|
let(:conn) do
|
|
5
|
-
Faraday.new(url: 'http://
|
|
5
|
+
Faraday.new(url: 'http://httpbingo.org/api',
|
|
6
6
|
headers: { 'Mime-Version' => '1.0' },
|
|
7
7
|
request: { oauth: { consumer_key: 'anonymous' } })
|
|
8
8
|
end
|
|
@@ -27,7 +27,7 @@ RSpec.describe Faraday::Request do
|
|
|
27
27
|
|
|
28
28
|
it { expect(subject.path).to eq(URI.parse('foo.json')) }
|
|
29
29
|
it { expect(subject.params).to eq('a' => '1') }
|
|
30
|
-
it { expect(subject.to_env(conn).url.to_s).to eq('http://
|
|
30
|
+
it { expect(subject.to_env(conn).url.to_s).to eq('http://httpbingo.org/api/foo.json?a=1') }
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
context 'when setting the url on setup with a string path and params' do
|
|
@@ -35,7 +35,7 @@ RSpec.describe Faraday::Request do
|
|
|
35
35
|
|
|
36
36
|
it { expect(subject.path).to eq('foo.json') }
|
|
37
37
|
it { expect(subject.params).to eq('a' => 1) }
|
|
38
|
-
it { expect(subject.to_env(conn).url.to_s).to eq('http://
|
|
38
|
+
it { expect(subject.to_env(conn).url.to_s).to eq('http://httpbingo.org/api/foo.json?a=1') }
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
context 'when setting the url on setup with a path including params' do
|
|
@@ -43,7 +43,7 @@ RSpec.describe Faraday::Request do
|
|
|
43
43
|
|
|
44
44
|
it { expect(subject.path).to eq('foo.json') }
|
|
45
45
|
it { expect(subject.params).to eq('a' => '1', 'b' => '2') }
|
|
46
|
-
it { expect(subject.to_env(conn).url.to_s).to eq('http://
|
|
46
|
+
it { expect(subject.to_env(conn).url.to_s).to eq('http://httpbingo.org/api/foo.json?a=1&b=2') }
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
context 'when setting a header on setup with []= syntax' do
|
|
@@ -68,9 +68,9 @@ RSpec.describe Faraday::Utils::Headers do
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
context 'when response headers values include a colon' do
|
|
71
|
-
let(:headers) { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nLocation: http://
|
|
71
|
+
let(:headers) { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nLocation: http://httpbingo.org/\r\n\r\n" }
|
|
72
72
|
|
|
73
|
-
it { expect(subject['location']).to eq('http://
|
|
73
|
+
it { expect(subject['location']).to eq('http://httpbingo.org/') }
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
context 'when response headers include a blank line' do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: faraday
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- "@technoweenie"
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2022-
|
|
13
|
+
date: 2022-02-03 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: faraday-net_http
|
|
@@ -91,6 +91,7 @@ files:
|
|
|
91
91
|
- spec/faraday/adapter_spec.rb
|
|
92
92
|
- spec/faraday/connection_spec.rb
|
|
93
93
|
- spec/faraday/error_spec.rb
|
|
94
|
+
- spec/faraday/middleware_registry_spec.rb
|
|
94
95
|
- spec/faraday/middleware_spec.rb
|
|
95
96
|
- spec/faraday/options/env_spec.rb
|
|
96
97
|
- spec/faraday/options/options_spec.rb
|
|
@@ -124,7 +125,7 @@ licenses:
|
|
|
124
125
|
- MIT
|
|
125
126
|
metadata:
|
|
126
127
|
homepage_uri: https://lostisland.github.io/faraday
|
|
127
|
-
changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.
|
|
128
|
+
changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.2.0
|
|
128
129
|
source_code_uri: https://github.com/lostisland/faraday
|
|
129
130
|
bug_tracker_uri: https://github.com/lostisland/faraday/issues
|
|
130
131
|
post_install_message:
|