Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package rubygem-faraday for openSUSE:Factory
checked in at 2022-02-25 21:25:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-faraday (Old)
and /work/SRC/openSUSE:Factory/.rubygem-faraday.new.1958 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-faraday"
Fri Feb 25 21:25:09 2022 rev:27 rq:957505 version:2.2.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-faraday/rubygem-faraday.changes
2022-02-15 23:57:28.608245076 +0100
+++
/work/SRC/openSUSE:Factory/.rubygem-faraday.new.1958/rubygem-faraday.changes
2022-02-25 21:25:40.223644718 +0100
@@ -1,0 +2,81 @@
+Mon Feb 21 11:31:14 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 2.2.0
+ see installed CHANGELOG.md
+
+ ## The changelog has moved!
+
+ This file is not being updated anymore. Instead, please check the
[Releases](https://github.com/lostisland/faraday/releases) page.
+
+ ## [2.1.0](https://github.com/lostisland/faraday/compare/v2.0.1...v2.1.0)
(2022-01-15)
+
+ * Fix test adapter thread safety by @iMacTia in
[#1380](https://github.com/lostisland/faraday/pull/1380)
+ * Add default adapter options by @hirasawayuki in
[#1382](https://github.com/lostisland/faraday/pull/1382)
+ * CI: Add Ruby 3.1 to matrix by @petergoldstein in
[#1374](https://github.com/lostisland/faraday/pull/1374)
+ * docs: fix regex pattern in logger.md examples by @hirasawayuki in
[#1378](https://github.com/lostisland/faraday/pull/1378)
+
+ ## [2.0.1](https://github.com/lostisland/faraday/compare/v2.0.0...v2.0.1)
(2022-01-05)
+
+ * Re-add `faraday-net_http` as default adapter by @iMacTia in
[#1366](https://github.com/lostisland/faraday/pull/1366)
+ * Updated sample format in UPGRADING.md by @vimutter in
[#1361](https://github.com/lostisland/faraday/pull/1361)
+ * docs: Make UPGRADING examples more copyable by @olleolleolle in
[#1363](https://github.com/lostisland/faraday/pull/1363)
+
+ ## [2.0.0](https://github.com/lostisland/faraday/compare/v1.8.0...v2.0.0)
(2022-01-04)
+
+ The next major release is here, and it comes almost 2 years after the
release of v1.0!
+
+ This release changes the way you use Faraday and embraces a new paradigm of
Faraday as an ecosystem, rather than a library.
+
+ 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.
+
+ As a result, all adapters and some middleware have moved out and are now
shipped as standalone gems ????!
+
+ 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.
+
+ 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 ????.
+
+ 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 ????.
+
+ ## What's Changed
+
+ * Autoloading, dependency loading and middleware registry cleanup by
@iMacTia in [#1301](https://github.com/lostisland/faraday/pull/1301)
+ * Move JSON middleware (request and response) from faraday_middleware by
@iMacTia in [#1300](https://github.com/lostisland/faraday/pull/1300)
+ * Remove deprecated `Faraday::Request#method` by @olleolleolle in
[#1303](https://github.com/lostisland/faraday/pull/1303)
+ * Remove deprecated `Faraday::UploadIO` by @iMacTia in
[#1307](https://github.com/lostisland/faraday/pull/1307)
+ * [1.x] Deprecate Authorization helpers in `Faraday::Connection` by @iMacTia
in [#1306](https://github.com/lostisland/faraday/pull/1306)
+ * Drop deprecated auth helpers from Connection and refactor auth middleware
by @iMacTia in [#1308](https://github.com/lostisland/faraday/pull/1308)
+ * Add Faraday 1.x examples in authentication.md docs by @iMacTia in
[#1320](https://github.com/lostisland/faraday/pull/1320)
+ * Fix passing a URL with embedded basic auth by @iMacTia in
[#1324](https://github.com/lostisland/faraday/pull/1324)
+ * Register JSON middleware by @mollerhoj in
[#1331](https://github.com/lostisland/faraday/pull/1331)
+ * Retry middleware should handle string exception class name consistently by
@jrochkind in [#1334](https://github.com/lostisland/faraday/pull/1334)
+ * Improve request info in exceptions raised by RaiseError Middleware by
@willianzocolau in [#1335](https://github.com/lostisland/faraday/pull/1335)
+ * Remove net-http adapter and update docs by @iMacTia in
[#1336](https://github.com/lostisland/faraday/pull/1336)
+ * Explain plan for faraday_middleware in UPGRADING.md by @iMacTia in
[#1339](https://github.com/lostisland/faraday/pull/1339)
+ * Scripts folder cleanup by @iMacTia in
[#1340](https://github.com/lostisland/faraday/pull/1340)
+ * Replace `Hash#merge` with `Utils#deep_merge` for connection options by
@xkwd in [#1343](https://github.com/lostisland/faraday/pull/1343)
+ * Callable authorizers by @sled in
[#1345](https://github.com/lostisland/faraday/pull/1345)
+ * Default value for exc error by @DariuszMusielak in
[#1351](https://github.com/lostisland/faraday/pull/1351)
+ * Don't call `retry_block` unless a retry is going to happen by @jrochkind
in [#1350](https://github.com/lostisland/faraday/pull/1350)
+ * Improve documentation for v2 by @iMacTia in
[#1353](https://github.com/lostisland/faraday/pull/1353)
+ * Remove default `default_adapter` (yes, you read that right) by @iMacTia in
[#1354](https://github.com/lostisland/faraday/pull/1354)
+ * Remove retry middleware by @iMacTia in
[#1356](https://github.com/lostisland/faraday/pull/1356)
+ * Remove multipart middleware and all its documentation and tests by
@iMacTia in [#1357](https://github.com/lostisland/faraday/pull/1357)
+
+ ## [1.9.3](https://github.com/lostisland/faraday/compare/v1.9.2...v1.9.3)
(2022-01-06)
+
+ * Re-add support for Ruby 2.4+ by @iMacTia in
[#1371](https://github.com/lostisland/faraday/pull/1371)
+
+ ## [1.9.2](https://github.com/lostisland/faraday/compare/v1.9.1...v1.9.2)
(2022-01-06)
+
+ * Add alias with legacy name to gemified middleware by @iMacTia in
[#1372](https://github.com/lostisland/faraday/pull/1372)
+
+ ## [1.9.1](https://github.com/lostisland/faraday/compare/v1.9.0...v1.9.1)
(2022-01-06)
+
+ * Update adapter dependencies in Gemspec by @iMacTia in
[#1370](https://github.com/lostisland/faraday/pull/1370)
+
+ ## [1.9.0](https://github.com/lostisland/faraday/compare/v1.8.0...v1.9.0)
(2022-01-06)
+
+ * Use external multipart and retry middleware by @iMacTia in
[#1367](https://github.com/lostisland/faraday/pull/1367)
+
+
+-------------------------------------------------------------------
Old:
----
faraday-2.1.0.gem
New:
----
faraday-2.2.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-faraday.spec ++++++
--- /var/tmp/diff_new_pack.Lonbcy/_old 2022-02-25 21:25:40.735644809 +0100
+++ /var/tmp/diff_new_pack.Lonbcy/_new 2022-02-25 21:25:40.739644810 +0100
@@ -24,7 +24,7 @@
#
Name: rubygem-faraday
-Version: 2.1.0
+Version: 2.2.0
Release: 0
%define mod_name faraday
%define mod_full_name %{mod_name}-%{version}
++++++ faraday-2.1.0.gem -> faraday-2.2.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2022-01-15 15:35:36.000000000 +0100
+++ new/CHANGELOG.md 2022-02-03 10:37:28.000000000 +0100
@@ -1,5 +1,79 @@
# Faraday Changelog
+## The changelog has moved!
+
+This file is not being updated anymore. Instead, please check the
[Releases](https://github.com/lostisland/faraday/releases) page.
+
+## [2.1.0](https://github.com/lostisland/faraday/compare/v2.0.1...v2.1.0)
(2022-01-15)
+
+* Fix test adapter thread safety by @iMacTia in
[#1380](https://github.com/lostisland/faraday/pull/1380)
+* Add default adapter options by @hirasawayuki in
[#1382](https://github.com/lostisland/faraday/pull/1382)
+* CI: Add Ruby 3.1 to matrix by @petergoldstein in
[#1374](https://github.com/lostisland/faraday/pull/1374)
+* docs: fix regex pattern in logger.md examples by @hirasawayuki in
[#1378](https://github.com/lostisland/faraday/pull/1378)
+
+## [2.0.1](https://github.com/lostisland/faraday/compare/v2.0.0...v2.0.1)
(2022-01-05)
+
+* Re-add `faraday-net_http` as default adapter by @iMacTia in
[#1366](https://github.com/lostisland/faraday/pull/1366)
+* Updated sample format in UPGRADING.md by @vimutter in
[#1361](https://github.com/lostisland/faraday/pull/1361)
+* docs: Make UPGRADING examples more copyable by @olleolleolle in
[#1363](https://github.com/lostisland/faraday/pull/1363)
+
+## [2.0.0](https://github.com/lostisland/faraday/compare/v1.8.0...v2.0.0)
(2022-01-04)
+
+The next major release is here, and it comes almost 2 years after the release
of v1.0!
+
+This release changes the way you use Faraday and embraces a new paradigm of
Faraday as an ecosystem, rather than a library.
+
+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.
+
+As a result, all adapters and some middleware have moved out and are now
shipped as standalone gems ????!
+
+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.
+
+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 ????.
+
+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 ????.
+
+## What's Changed
+
+* Autoloading, dependency loading and middleware registry cleanup by @iMacTia
in [#1301](https://github.com/lostisland/faraday/pull/1301)
+* Move JSON middleware (request and response) from faraday_middleware by
@iMacTia in [#1300](https://github.com/lostisland/faraday/pull/1300)
+* Remove deprecated `Faraday::Request#method` by @olleolleolle in
[#1303](https://github.com/lostisland/faraday/pull/1303)
+* Remove deprecated `Faraday::UploadIO` by @iMacTia in
[#1307](https://github.com/lostisland/faraday/pull/1307)
+* [1.x] Deprecate Authorization helpers in `Faraday::Connection` by @iMacTia
in [#1306](https://github.com/lostisland/faraday/pull/1306)
+* Drop deprecated auth helpers from Connection and refactor auth middleware by
@iMacTia in [#1308](https://github.com/lostisland/faraday/pull/1308)
+* Add Faraday 1.x examples in authentication.md docs by @iMacTia in
[#1320](https://github.com/lostisland/faraday/pull/1320)
+* Fix passing a URL with embedded basic auth by @iMacTia in
[#1324](https://github.com/lostisland/faraday/pull/1324)
+* Register JSON middleware by @mollerhoj in
[#1331](https://github.com/lostisland/faraday/pull/1331)
+* Retry middleware should handle string exception class name consistently by
@jrochkind in [#1334](https://github.com/lostisland/faraday/pull/1334)
+* Improve request info in exceptions raised by RaiseError Middleware by
@willianzocolau in [#1335](https://github.com/lostisland/faraday/pull/1335)
+* Remove net-http adapter and update docs by @iMacTia in
[#1336](https://github.com/lostisland/faraday/pull/1336)
+* Explain plan for faraday_middleware in UPGRADING.md by @iMacTia in
[#1339](https://github.com/lostisland/faraday/pull/1339)
+* Scripts folder cleanup by @iMacTia in
[#1340](https://github.com/lostisland/faraday/pull/1340)
+* Replace `Hash#merge` with `Utils#deep_merge` for connection options by @xkwd
in [#1343](https://github.com/lostisland/faraday/pull/1343)
+* Callable authorizers by @sled in
[#1345](https://github.com/lostisland/faraday/pull/1345)
+* Default value for exc error by @DariuszMusielak in
[#1351](https://github.com/lostisland/faraday/pull/1351)
+* Don't call `retry_block` unless a retry is going to happen by @jrochkind in
[#1350](https://github.com/lostisland/faraday/pull/1350)
+* Improve documentation for v2 by @iMacTia in
[#1353](https://github.com/lostisland/faraday/pull/1353)
+* Remove default `default_adapter` (yes, you read that right) by @iMacTia in
[#1354](https://github.com/lostisland/faraday/pull/1354)
+* Remove retry middleware by @iMacTia in
[#1356](https://github.com/lostisland/faraday/pull/1356)
+* Remove multipart middleware and all its documentation and tests by @iMacTia
in [#1357](https://github.com/lostisland/faraday/pull/1357)
+
+## [1.9.3](https://github.com/lostisland/faraday/compare/v1.9.2...v1.9.3)
(2022-01-06)
+
+* Re-add support for Ruby 2.4+ by @iMacTia in
[#1371](https://github.com/lostisland/faraday/pull/1371)
+
+## [1.9.2](https://github.com/lostisland/faraday/compare/v1.9.1...v1.9.2)
(2022-01-06)
+
+* Add alias with legacy name to gemified middleware by @iMacTia in
[#1372](https://github.com/lostisland/faraday/pull/1372)
+
+## [1.9.1](https://github.com/lostisland/faraday/compare/v1.9.0...v1.9.1)
(2022-01-06)
+
+* Update adapter dependencies in Gemspec by @iMacTia in
[#1370](https://github.com/lostisland/faraday/pull/1370)
+
+## [1.9.0](https://github.com/lostisland/faraday/compare/v1.8.0...v1.9.0)
(2022-01-06)
+
+* Use external multipart and retry middleware by @iMacTia in
[#1367](https://github.com/lostisland/faraday/pull/1367)
+
## [1.8.0](https://github.com/lostisland/faraday/releases/tag/v1.8.0)
(2021-09-18)
### Features
@@ -65,7 +139,7 @@
### Highlights
-With this release, we continue the work of gradually moving out adapters into
their own gems ????
+With this release, we continue the work of gradually moving out adapters into
their own gems ????
Thanks to @MikeRogers0 for helping the Faraday team in progressing with this
quest ????
And thanks to @olleolleolle efforts, Faraday is becoming more inclusive than
ever ????
@@ -112,7 +186,7 @@
## [v1.3.0](https://github.com/lostisland/faraday/releases/tag/v1.3.0)
(2020-12-31)
### Highlights
-Faraday v1.3.0 is the first release to officially support Ruby 3.0 in the CI
pipeline ???? ????!
+Faraday v1.3.0 is the first release to officially support Ruby 3.0 in the CI
pipeline ???? ????!
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) ????!
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 @@
* Allows `parse` method to be private/protected in response middleware (#1123)
* Encode Spaces in Query Strings as '%20' Instead of '+' (#1125)
* Limits rack to v2.0.x (#1127)
-* Adapter Registry reads also use mutex (#1136)
+* Adapter Registry reads also use mutex (#1136)
### Documentation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/README.md new/README.md
--- old/README.md 2022-01-15 15:35:36.000000000 +0100
+++ new/README.md 2022-02-03 10:37:28.000000000 +0100
@@ -10,11 +10,6 @@
You probably don't want to use Faraday directly in your project, as it will
lack an actual client library to perform
requests. Instead, you probably want to have a look at [Awesome
Faraday][awesome] for a list of available adapters.
-## FARADAY 2.0
-
-You're reading the README and looking at the code of our upcoming v2.0 release
(the `main` branch, currently in alpha).
-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).
-
## Getting Started
The best starting point is the [Faraday Website][website], with its
introduction and explanation.
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/examples/client_spec.rb new/examples/client_spec.rb
--- old/examples/client_spec.rb 2022-01-15 15:35:36.000000000 +0100
+++ new/examples/client_spec.rb 2022-02-03 10:37:28.000000000 +0100
@@ -12,10 +12,10 @@
@conn = conn
end
- def sushi(jname, params: {})
+ def httpbingo(jname, params: {})
res = @conn.get("/#{jname}", params)
data = JSON.parse(res.body)
- data['name']
+ data['origin']
end
end
@@ -24,42 +24,42 @@
let(:conn) { Faraday.new { |b| b.adapter(:test, stubs) } }
let(:client) { Client.new(conn) }
- it 'parses name' do
- stubs.get('/ebi') do |env|
+ it 'parses origin' do
+ stubs.get('/ip') do |env|
# optional: you can inspect the Faraday::Env
- expect(env.url.path).to eq('/ebi')
+ expect(env.url.path).to eq('/ip')
[
200,
{ 'Content-Type': 'application/javascript' },
- '{"name": "shrimp"}'
+ '{"origin": "127.0.0.1"}'
]
end
# uncomment to trigger stubs.verify_stubbed_calls failure
# stubs.get('/unused') { [404, {}, ''] }
- expect(client.sushi('ebi')).to eq('shrimp')
+ expect(client.httpbingo('ip')).to eq('127.0.0.1')
stubs.verify_stubbed_calls
end
it 'handles 404' do
- stubs.get('/ebi') do
+ stubs.get('/api') do
[
404,
{ 'Content-Type': 'application/javascript' },
'{}'
]
end
- expect(client.sushi('ebi')).to be_nil
+ expect(client.httpbingo('api')).to be_nil
stubs.verify_stubbed_calls
end
it 'handles exception' do
- stubs.get('/ebi') do
+ stubs.get('/api') do
raise Faraday::ConnectionFailed
end
- expect { client.sushi('ebi') }.to raise_error(Faraday::ConnectionFailed)
+ expect { client.httpbingo('api') }.to
raise_error(Faraday::ConnectionFailed)
stubs.verify_stubbed_calls
end
@@ -67,17 +67,17 @@
let(:stubs) { Faraday::Adapter::Test::Stubs.new(strict_mode: true) }
it 'verifies the all parameter values are identical' do
- stubs.get('/ebi?abc=123') do
+ stubs.get('/api?abc=123') do
[
200,
{ 'Content-Type': 'application/javascript' },
- '{"name": "shrimp"}'
+ '{"origin": "127.0.0.1"}'
]
end
# uncomment to raise Stubs::NotFound
- # expect(client.sushi('ebi', params: { abc: 123, foo: 'Kappa' })).to
eq('shrimp')
- expect(client.sushi('ebi', params: { abc: 123 })).to eq('shrimp')
+ # expect(client.httpbingo('api', params: { abc: 123, foo: 'Kappa' })).to
eq('127.0.0.1')
+ expect(client.httpbingo('api', params: { abc: 123 })).to eq('127.0.0.1')
stubs.verify_stubbed_calls
end
end
@@ -86,11 +86,11 @@
let(:conn) { Faraday.new(request: { params_encoder:
Faraday::FlatParamsEncoder }) { |b| b.adapter(:test, stubs) } }
it 'handles the same multiple URL parameters' do
- stubs.get('/ebi?a=x&a=y&a=z') { [200, { 'Content-Type' =>
'application/json' }, '{"name": "shrimp"}'] }
+ stubs.get('/api?a=x&a=y&a=z') { [200, { 'Content-Type' =>
'application/json' }, '{"origin": "127.0.0.1"}'] }
# uncomment to raise Stubs::NotFound
- # expect(client.sushi('ebi', params: { a: %w[x y] })).to eq('shrimp')
- expect(client.sushi('ebi', params: { a: %w[x y z] })).to eq('shrimp')
+ # expect(client.httpbingo('api', params: { a: %w[x y] })).to
eq('127.0.0.1')
+ expect(client.httpbingo('api', params: { a: %w[x y z] })).to
eq('127.0.0.1')
stubs.verify_stubbed_calls
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/examples/client_test.rb new/examples/client_test.rb
--- old/examples/client_test.rb 2022-01-15 15:35:36.000000000 +0100
+++ new/examples/client_test.rb 2022-02-03 10:37:28.000000000 +0100
@@ -13,24 +13,24 @@
@conn = conn
end
- def sushi(jname, params: {})
+ def httpbingo(jname, params: {})
res = @conn.get("/#{jname}", params)
data = JSON.parse(res.body)
- data['name']
+ data['origin']
end
end
# Example API client test
class ClientTest < Test::Unit::TestCase
- def test_sushi_name
+ def test_httpbingo_name
stubs = Faraday::Adapter::Test::Stubs.new
- stubs.get('/ebi') do |env|
+ stubs.get('/api') do |env|
# optional: you can inspect the Faraday::Env
- assert_equal '/ebi', env.url.path
+ assert_equal '/api', env.url.path
[
200,
{ 'Content-Type': 'application/javascript' },
- '{"name": "shrimp"}'
+ '{"origin": "127.0.0.1"}'
]
end
@@ -38,13 +38,13 @@
# stubs.get('/unused') { [404, {}, ''] }
cli = client(stubs)
- assert_equal 'shrimp', cli.sushi('ebi')
+ assert_equal '127.0.0.1', cli.httpbingo('api')
stubs.verify_stubbed_calls
end
- def test_sushi_not_found
+ def test_httpbingo_not_found
stubs = Faraday::Adapter::Test::Stubs.new
- stubs.get('/ebi') do
+ stubs.get('/api') do
[
404,
{ 'Content-Type': 'application/javascript' },
@@ -53,48 +53,48 @@
end
cli = client(stubs)
- assert_nil cli.sushi('ebi')
+ assert_nil cli.httpbingo('api')
stubs.verify_stubbed_calls
end
- def test_sushi_exception
+ def test_httpbingo_exception
stubs = Faraday::Adapter::Test::Stubs.new
- stubs.get('/ebi') do
+ stubs.get('/api') do
raise Faraday::ConnectionFailed
end
cli = client(stubs)
assert_raise Faraday::ConnectionFailed do
- cli.sushi('ebi')
+ cli.httpbingo('api')
end
stubs.verify_stubbed_calls
end
def test_strict_mode
stubs = Faraday::Adapter::Test::Stubs.new(strict_mode: true)
- stubs.get('/ebi?abc=123') do
+ stubs.get('/api?abc=123') do
[
200,
{ 'Content-Type': 'application/javascript' },
- '{"name": "shrimp"}'
+ '{"origin": "127.0.0.1"}'
]
end
cli = client(stubs)
- assert_equal 'shrimp', cli.sushi('ebi', params: { abc: 123 })
+ assert_equal '127.0.0.1', cli.httpbingo('api', params: { abc: 123 })
# uncomment to raise Stubs::NotFound
- # assert_equal 'shrimp', cli.sushi('ebi', params: { abc: 123, foo: 'Kappa'
})
+ # assert_equal '127.0.0.1', cli.httpbingo('api', params: { abc: 123, foo:
'Kappa' })
stubs.verify_stubbed_calls
end
def test_non_default_params_encoder
stubs = Faraday::Adapter::Test::Stubs.new(strict_mode: true)
- stubs.get('/ebi?a=x&a=y&a=z') do
+ stubs.get('/api?a=x&a=y&a=z') do
[
200,
{ 'Content-Type': 'application/javascript' },
- '{"name": "shrimp"}'
+ '{"origin": "127.0.0.1"}'
]
end
conn = Faraday.new(request: { params_encoder: Faraday::FlatParamsEncoder
}) do |builder|
@@ -102,10 +102,10 @@
end
cli = Client.new(conn)
- assert_equal 'shrimp', cli.sushi('ebi', params: { a: %w[x y z] })
+ assert_equal '127.0.0.1', cli.httpbingo('api', params: { a: %w[x y z] })
# uncomment to raise Stubs::NotFound
- # assert_equal 'shrimp', cli.sushi('ebi', params: { a: %w[x y] })
+ # assert_equal '127.0.0.1', cli.httpbingo('api', params: { a: %w[x y] })
stubs.verify_stubbed_calls
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/faraday/connection.rb
new/lib/faraday/connection.rb
--- old/lib/faraday/connection.rb 2022-01-15 15:35:36.000000000 +0100
+++ new/lib/faraday/connection.rb 2022-02-03 10:37:28.000000000 +0100
@@ -6,9 +6,9 @@
#
# @example
#
- # conn = Faraday::Connection.new 'http://sushi.com'
+ # conn = Faraday::Connection.new 'http://httpbingo.org'
#
- # # GET http://sushi.com/nigiri
+ # # GET http://httpbingo.org/nigiri
# conn.get 'nigiri'
# # => #<Faraday::Response>
#
@@ -349,11 +349,11 @@
# @example
#
# conn = Faraday::Connection.new { ... }
- # conn.url_prefix = "https://sushi.com/api"
+ # conn.url_prefix = "https://httpbingo.org/api"
# conn.scheme # => https
# conn.path_prefix # => "/api"
#
- # conn.get("nigiri?page=2") # accesses https://sushi.com/api/nigiri
+ # conn.get("nigiri?page=2") # accesses https://httpbingo.org/api/nigiri
def url_prefix=(url, encoder = nil)
uri = @url_prefix = Utils.URI(url)
self.path_prefix = uri.path
@@ -395,15 +395,15 @@
#
# @example
# conn = Faraday::Connection.new { ... }
- # conn.url_prefix = "https://sushi.com/api?token=abc"
+ # conn.url_prefix = "https://httpbingo.org/api?token=abc"
# conn.scheme # => https
# conn.path_prefix # => "/api"
#
# conn.build_url("nigiri?page=2")
- # # => https://sushi.com/api/nigiri?token=abc&page=2
+ # # => https://httpbingo.org/api/nigiri?token=abc&page=2
#
# conn.build_url("nigiri", page: 2)
- # # => https://sushi.com/api/nigiri?token=abc&page=2
+ # # => https://httpbingo.org/api/nigiri?token=abc&page=2
#
def build_url(url = nil, extra_params = nil)
uri = build_exclusive_url(url)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/faraday/middleware_registry.rb
new/lib/faraday/middleware_registry.rb
--- old/lib/faraday/middleware_registry.rb 2022-01-15 15:35:36.000000000
+0100
+++ new/lib/faraday/middleware_registry.rb 2022-02-03 10:37:28.000000000
+0100
@@ -53,13 +53,31 @@
# Faraday::Middleware.lookup_middleware(:foo)
# # => Faraday::Whatever
def lookup_middleware(key)
- registered_middleware[key] ||
+ load_middleware(key) ||
raise(Faraday::Error, "#{key.inspect} is not registered on #{self}")
end
+ private
+
def middleware_mutex(&block)
@middleware_mutex ||= Monitor.new
@middleware_mutex.synchronize(&block)
end
+
+ def load_middleware(key)
+ value = registered_middleware[key]
+ case value
+ when Module
+ value
+ when Symbol, String
+ middleware_mutex do
+ @registered_middleware[key] = const_get(value)
+ end
+ when Proc
+ middleware_mutex do
+ @registered_middleware[key] = value.call
+ end
+ end
+ end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/faraday/rack_builder.rb
new/lib/faraday/rack_builder.rb
--- old/lib/faraday/rack_builder.rb 2022-01-15 15:35:36.000000000 +0100
+++ new/lib/faraday/rack_builder.rb 2022-02-03 10:37:28.000000000 +0100
@@ -8,7 +8,7 @@
# middleware stack (heavily inspired by Rack).
#
# @example
- # Faraday::Connection.new(url: 'http://sushi.com') do |builder|
+ # Faraday::Connection.new(url: 'http://httpbingo.org') do |builder|
# builder.request :url_encoded # Faraday::Request::UrlEncoded
# builder.adapter :net_http # Faraday::Adapter::NetHttp
# end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/faraday/version.rb new/lib/faraday/version.rb
--- old/lib/faraday/version.rb 2022-01-15 15:35:36.000000000 +0100
+++ new/lib/faraday/version.rb 2022-02-03 10:37:28.000000000 +0100
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Faraday
- VERSION = '2.1.0'
+ VERSION = '2.2.0'
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2022-01-15 15:35:36.000000000 +0100
+++ new/metadata 2022-02-03 10:37:28.000000000 +0100
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: faraday
version: !ruby/object:Gem::Version
- version: 2.1.0
+ version: 2.2.0
platform: ruby
authors:
- "@technoweenie"
@@ -10,7 +10,7 @@
autorequire:
bindir: bin
cert_chain: []
-date: 2022-01-15 00:00:00.000000000 Z
+date: 2022-02-03 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: faraday-net_http
@@ -91,6 +91,7 @@
- spec/faraday/adapter_spec.rb
- spec/faraday/connection_spec.rb
- spec/faraday/error_spec.rb
+- spec/faraday/middleware_registry_spec.rb
- spec/faraday/middleware_spec.rb
- spec/faraday/options/env_spec.rb
- spec/faraday/options/options_spec.rb
@@ -124,7 +125,7 @@
- MIT
metadata:
homepage_uri: https://lostisland.github.io/faraday
- changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.1.0
+ changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.2.0
source_code_uri: https://github.com/lostisland/faraday
bug_tracker_uri: https://github.com/lostisland/faraday/issues
post_install_message:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/faraday/connection_spec.rb
new/spec/faraday/connection_spec.rb
--- old/spec/faraday/connection_spec.rb 2022-01-15 15:35:36.000000000 +0100
+++ new/spec/faraday/connection_spec.rb 2022-02-03 10:37:28.000000000 +0100
@@ -12,9 +12,9 @@
shared_examples 'initializer with url' do
context 'with simple url' do
- let(:address) { 'http://sushi.com' }
+ let(:address) { 'http://httpbingo.org' }
- it { expect(subject.host).to eq('sushi.com') }
+ it { expect(subject.host).to eq('httpbingo.org') }
it { expect(subject.port).to eq(80) }
it { expect(subject.scheme).to eq('http') }
it { expect(subject.path_prefix).to eq('/') }
@@ -22,7 +22,7 @@
end
context 'with complex url' do
- let(:address) { 'http://sushi.com:815/fish?a=1' }
+ let(:address) { 'http://httpbingo.org:815/fish?a=1' }
it { expect(subject.port).to eq(815) }
it { expect(subject.path_prefix).to eq('/fish') }
@@ -41,17 +41,17 @@
after { Faraday.default_connection_options = nil }
it 'works with implicit url' do
- conn = Faraday.new 'http://sushi.com/foo'
+ conn = Faraday.new 'http://httpbingo.org/foo'
expect(conn.options.timeout).to eq(10)
end
it 'works with option url' do
- conn = Faraday.new url: 'http://sushi.com/foo'
+ conn = Faraday.new url: 'http://httpbingo.org/foo'
expect(conn.options.timeout).to eq(10)
end
it 'works with instance connection options' do
- conn = Faraday.new 'http://sushi.com/foo', request: { open_timeout: 1 }
+ conn = Faraday.new 'http://httpbingo.org/foo', request: { open_timeout: 1 }
expect(conn.options.timeout).to eq(10)
expect(conn.options.open_timeout).to eq(1)
end
@@ -61,7 +61,7 @@
conn.options.timeout = 1
expect(Faraday.default_connection_options.request.timeout).to eq(10)
- other = Faraday.new url: 'https://sushi.com/foo'
+ other = Faraday.new url: 'https://httpbingo.org/foo'
other.options.timeout = 1
expect(Faraday.default_connection_options.request.timeout).to eq(10)
@@ -81,14 +81,14 @@
subject { conn }
context 'with implicit url param' do
- # Faraday::Connection.new('http://sushi.com')
+ # Faraday::Connection.new('http://httpbingo.org')
let(:url) { address }
it_behaves_like 'initializer with url'
end
context 'with explicit url param' do
- # Faraday::Connection.new(url: 'http://sushi.com')
+ # Faraday::Connection.new(url: 'http://httpbingo.org')
let(:url) { { url: address } }
it_behaves_like 'initializer with url'
@@ -108,13 +108,13 @@
end
context 'with custom params and params in url' do
- let(:url) { 'http://sushi.com/fish?a=1&b=2' }
+ let(:url) { 'http://httpbingo.org/fish?a=1&b=2' }
let(:options) { { params: { a: 3 } } }
it { expect(subject.params).to eq('a' => 3, 'b' => '2') }
end
context 'with basic_auth in url' do
- let(:url) { 'http://Aladdin:open%[email protected]/fish' }
+ let(:url) { 'http://Aladdin:open%[email protected]/fish' }
it { expect(subject.headers['Authorization']).to eq('Basic
QWxhZGRpbjpvcGVuIHNlc2FtZQ==') }
end
@@ -141,7 +141,7 @@
let(:conn) do
Faraday::Connection.new(params: { 'a' => '1' }) do |faraday|
faraday.adapter :test
- faraday.url_prefix = 'http://sushi.com/omnom'
+ faraday.url_prefix = 'http://httpbingo.org/omnom'
end
end
@@ -165,8 +165,8 @@
subject { conn.build_exclusive_url('sake.html') }
it 'uses connection host as default host' do
- conn.host = 'sushi.com'
- expect(subject.host).to eq('sushi.com')
+ conn.host = 'httpbingo.org'
+ expect(subject.host).to eq('httpbingo.org')
expect(subject.scheme).to eq('http')
end
@@ -203,10 +203,10 @@
end
context 'with complete url' do
- subject { conn.build_exclusive_url('http://sushi.com/sake.html?a=1') }
+ subject { conn.build_exclusive_url('http://httpbingo.org/sake.html?a=1')
}
it { expect(subject.scheme).to eq('http') }
- it { expect(subject.host).to eq('sushi.com') }
+ it { expect(subject.host).to eq('httpbingo.org') }
it { expect(subject.port).to eq(80) }
it { expect(subject.path).to eq('/sake.html') }
it { expect(subject.query).to eq('a=1') }
@@ -214,35 +214,35 @@
it 'overrides connection port for absolute url' do
conn.port = 23
- uri = conn.build_exclusive_url('http://sushi.com')
+ uri = conn.build_exclusive_url('http://httpbingo.org')
expect(uri.port).to eq(80)
end
it 'does not add ending slash given nil url' do
- conn.url_prefix = 'http://sushi.com/nigiri'
+ conn.url_prefix = 'http://httpbingo.org/nigiri'
uri = conn.build_exclusive_url
expect(uri.path).to eq('/nigiri')
end
it 'does not add ending slash given empty url' do
- conn.url_prefix = 'http://sushi.com/nigiri'
+ conn.url_prefix = 'http://httpbingo.org/nigiri'
uri = conn.build_exclusive_url('')
expect(uri.path).to eq('/nigiri')
end
it 'does not use connection params' do
- conn.url_prefix = 'http://sushi.com/nigiri'
+ conn.url_prefix = 'http://httpbingo.org/nigiri'
conn.params = { a: 1 }
- expect(conn.build_exclusive_url.to_s).to eq('http://sushi.com/nigiri')
+ expect(conn.build_exclusive_url.to_s).to
eq('http://httpbingo.org/nigiri')
end
it 'allows to provide params argument' do
- conn.url_prefix = 'http://sushi.com/nigiri'
+ conn.url_prefix = 'http://httpbingo.org/nigiri'
conn.params = { a: 1 }
params = Faraday::Utils::ParamsHash.new
params[:a] = 2
uri = conn.build_exclusive_url(nil, params)
- expect(uri.to_s).to eq('http://sushi.com/nigiri?a=2')
+ expect(uri.to_s).to eq('http://httpbingo.org/nigiri?a=2')
end
it 'handles uri instances' do
@@ -251,34 +251,34 @@
end
it 'always returns new URI instance' do
- conn.url_prefix = 'http://sushi.com'
+ conn.url_prefix = 'http://httpbingo.org'
uri1 = conn.build_exclusive_url(nil)
uri2 = conn.build_exclusive_url(nil)
expect(uri1).not_to equal(uri2)
end
context 'with url_prefixed connection' do
- let(:url) { 'http://sushi.com/sushi/' }
+ let(:url) { 'http://httpbingo.org/get/' }
it 'parses url and changes scheme' do
conn.scheme = 'https'
uri = conn.build_exclusive_url('sake.html')
- expect(uri.to_s).to eq('https://sushi.com/sushi/sake.html')
+ expect(uri.to_s).to eq('https://httpbingo.org/get/sake.html')
end
it 'joins url to base with ending slash' do
uri = conn.build_exclusive_url('sake.html')
- expect(uri.to_s).to eq('http://sushi.com/sushi/sake.html')
+ expect(uri.to_s).to eq('http://httpbingo.org/get/sake.html')
end
it 'used default base with ending slash' do
uri = conn.build_exclusive_url
- expect(uri.to_s).to eq('http://sushi.com/sushi/')
+ expect(uri.to_s).to eq('http://httpbingo.org/get/')
end
it 'overrides base' do
uri = conn.build_exclusive_url('/sake/')
- expect(uri.to_s).to eq('http://sushi.com/sake/')
+ expect(uri.to_s).to eq('http://httpbingo.org/sake/')
end
end
@@ -307,22 +307,22 @@
end
describe '#build_url' do
- let(:url) { 'http://sushi.com/nigiri' }
+ let(:url) { 'http://httpbingo.org/nigiri' }
it 'uses params' do
conn.params = { a: 1, b: 1 }
- expect(conn.build_url.to_s).to eq('http://sushi.com/nigiri?a=1&b=1')
+ expect(conn.build_url.to_s).to eq('http://httpbingo.org/nigiri?a=1&b=1')
end
it 'merges params' do
conn.params = { a: 1, b: 1 }
url = conn.build_url(nil, b: 2, c: 3)
- expect(url.to_s).to eq('http://sushi.com/nigiri?a=1&b=2&c=3')
+ expect(url.to_s).to eq('http://httpbingo.org/nigiri?a=1&b=2&c=3')
end
end
describe '#build_request' do
- let(:url) { 'https://asushi.com/sake.html' }
+ let(:url) { 'https://ahttpbingo.org/sake.html' }
let(:request) { conn.build_request(:get) }
before do
@@ -339,7 +339,7 @@
describe '#to_env' do
subject { conn.build_request(:get).to_env(conn).url }
- let(:url) { 'http://sushi.com/sake.html' }
+ let(:url) { 'http://httpbingo.org/sake.html' }
let(:options) { { params: @params } }
it 'parses url params into query' do
@@ -592,7 +592,7 @@
describe '#dup' do
subject { conn.dup }
- let(:url) { 'http://sushi.com/foo' }
+ let(:url) { 'http://httpbingo.org/foo' }
let(:options) do
{
ssl: { verify: :none },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/faraday/middleware_registry_spec.rb
new/spec/faraday/middleware_registry_spec.rb
--- old/spec/faraday/middleware_registry_spec.rb 1970-01-01
01:00:00.000000000 +0100
+++ new/spec/faraday/middleware_registry_spec.rb 2022-02-03
10:37:28.000000000 +0100
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+RSpec.describe Faraday::MiddlewareRegistry do
+ before do
+ stub_const('CustomMiddleware', custom_middleware_klass)
+ end
+ let(:custom_middleware_klass) { Class.new(Faraday::Middleware) }
+ let(:dummy) { Class.new { extend Faraday::MiddlewareRegistry } }
+
+ after { dummy.unregister_middleware(:custom) }
+
+ it 'allows to register with constant' do
+ dummy.register_middleware(custom: custom_middleware_klass)
+ expect(dummy.lookup_middleware(:custom)).to eq(custom_middleware_klass)
+ end
+
+ it 'allows to register with symbol' do
+ dummy.register_middleware(custom: :CustomMiddleware)
+ expect(dummy.lookup_middleware(:custom)).to eq(custom_middleware_klass)
+ end
+
+ it 'allows to register with string' do
+ dummy.register_middleware(custom: 'CustomMiddleware')
+ expect(dummy.lookup_middleware(:custom)).to eq(custom_middleware_klass)
+ end
+
+ it 'allows to register with Proc' do
+ dummy.register_middleware(custom: -> { custom_middleware_klass })
+ expect(dummy.lookup_middleware(:custom)).to eq(custom_middleware_klass)
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/faraday/rack_builder_spec.rb
new/spec/faraday/rack_builder_spec.rb
--- old/spec/faraday/rack_builder_spec.rb 2022-01-15 15:35:36.000000000
+0100
+++ new/spec/faraday/rack_builder_spec.rb 2022-02-03 10:37:28.000000000
+0100
@@ -110,18 +110,6 @@
end
end
- context 'with custom registered middleware' do
- let(:conn) { Faraday::Connection.new {} }
-
- after { Faraday::Middleware.unregister_middleware(:apple) }
-
- it 'allows to register with constant' do
- Faraday::Middleware.register_middleware(apple: Apple)
- subject.use(:apple)
- expect(subject.handlers).to eq([Apple])
- end
- end
-
context 'when having two handlers' do
let(:conn) { Faraday::Connection.new {} }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/faraday/request_spec.rb
new/spec/faraday/request_spec.rb
--- old/spec/faraday/request_spec.rb 2022-01-15 15:35:36.000000000 +0100
+++ new/spec/faraday/request_spec.rb 2022-02-03 10:37:28.000000000 +0100
@@ -2,7 +2,7 @@
RSpec.describe Faraday::Request do
let(:conn) do
- Faraday.new(url: 'http://sushi.com/api',
+ Faraday.new(url: 'http://httpbingo.org/api',
headers: { 'Mime-Version' => '1.0' },
request: { oauth: { consumer_key: 'anonymous' } })
end
@@ -27,7 +27,7 @@
it { expect(subject.path).to eq(URI.parse('foo.json')) }
it { expect(subject.params).to eq('a' => '1') }
- it { expect(subject.to_env(conn).url.to_s).to
eq('http://sushi.com/api/foo.json?a=1') }
+ it { expect(subject.to_env(conn).url.to_s).to
eq('http://httpbingo.org/api/foo.json?a=1') }
end
context 'when setting the url on setup with a string path and params' do
@@ -35,7 +35,7 @@
it { expect(subject.path).to eq('foo.json') }
it { expect(subject.params).to eq('a' => 1) }
- it { expect(subject.to_env(conn).url.to_s).to
eq('http://sushi.com/api/foo.json?a=1') }
+ it { expect(subject.to_env(conn).url.to_s).to
eq('http://httpbingo.org/api/foo.json?a=1') }
end
context 'when setting the url on setup with a path including params' do
@@ -43,7 +43,7 @@
it { expect(subject.path).to eq('foo.json') }
it { expect(subject.params).to eq('a' => '1', 'b' => '2') }
- it { expect(subject.to_env(conn).url.to_s).to
eq('http://sushi.com/api/foo.json?a=1&b=2') }
+ it { expect(subject.to_env(conn).url.to_s).to
eq('http://httpbingo.org/api/foo.json?a=1&b=2') }
end
context 'when setting a header on setup with []= syntax' do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/spec/faraday/utils/headers_spec.rb
new/spec/faraday/utils/headers_spec.rb
--- old/spec/faraday/utils/headers_spec.rb 2022-01-15 15:35:36.000000000
+0100
+++ new/spec/faraday/utils/headers_spec.rb 2022-02-03 10:37:28.000000000
+0100
@@ -68,9 +68,9 @@
end
context 'when response headers values include a colon' do
- let(:headers) { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nLocation:
http://sushi.com/\r\n\r\n" }
+ let(:headers) { "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nLocation:
http://httpbingo.org/\r\n\r\n" }
- it { expect(subject['location']).to eq('http://sushi.com/') }
+ it { expect(subject['location']).to eq('http://httpbingo.org/') }
end
context 'when response headers include a blank line' do