Skip to content

Commit 88d16b7

Browse files
iMacTiaolleolleolle
authored andcommitted
Provide removed middleware with its own section for clarity
1 parent 2d60ce0 commit 88d16b7

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

UPGRADING.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,34 @@ So don't fret yet! We're doing our best to support our `faraday_middleware` user
5858
It will obviously take time for some of the middleware in `faraday_middleware` to make its way into a separate gem, so we appreciate this might be an upgrade obstacle for some. However this is part of an effort to focus the core team resources tackling the most requested features.
5959
We'll be listening to the community and prioritize middleware that are most used, and will be welcoming contributors who want to become owners of the middleware when these become separate from the `faraday_middleware` repo.
6060

61+
### Bundled middleware moved out
62+
63+
Moving middleware into its own gem makes sense not only for `faraday_middleware`, but also for middleware bundled with Faraday.
64+
As of v2.0, the `retry` and `multipart` middleware have been moved to separate `faraday-retry` and `faraday-multipart` gems.
65+
These have been identified as good candidates due to their complexity and external dependencies.
66+
Thanks to this change, we were able to make Faraday 2.0 completely dependency free 🎉 (the only exception being `ruby2_keywords`, which will be necessary only while we keep supporting Ruby 2.6).
67+
68+
#### So what should I do if I currently use the `retry` or `multipart` middleware?
69+
70+
Upgrading is pretty simple, because the middleware was simply moved out to external gems.
71+
All you need to do is to add them to your gemfile (either `faraday-retry` or `faraday-multipart` and require them before usage:
72+
73+
```ruby
74+
# Gemfile
75+
gem 'faraday-multipart'
76+
gem 'faraday-retry'
77+
78+
# Connection initializer
79+
require 'faraday/retry'
80+
require 'faraday/multipart
81+
82+
conn = Faraday.new(url) do |f|
83+
f.request :multipart
84+
f.request :retry
85+
# ...
86+
end
87+
```
88+
6189
### Autoloading and dependencies
6290
6391
Faraday has until now provided and relied on a complex dynamic dependencies system.
@@ -85,7 +113,6 @@ For more details, see https://github.com/lostisland/faraday/pull/1306
85113
* Rename `Faraday::Request#method` to `#http_method`.
86114
* Remove `Faraday::Response::Middleware`. You can now use the new `on_complete` callback provided by `Faraday::Middleware`.
87115
* `Faraday.default_connection_options` will now be deep-merged into new connections to avoid overriding them (e.g. headers).
88-
* Retry and Multipart middleware have been moved to separate `faraday-retry` and `faraday-multipart` gems.
89116
* `Faraday::Builder#build` method is not exposed through `Faraday::Connection` anymore and does not reset the handlers if called multiple times. This method should be used internally only.
90117

91118
## Faraday 1.0

0 commit comments

Comments
 (0)