You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UPGRADING.md
+28-1Lines changed: 28 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,34 @@ So don't fret yet! We're doing our best to support our `faraday_middleware` user
58
58
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.
59
59
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.
60
60
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
+
61
89
### Autoloading and dependencies
62
90
63
91
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
85
113
*Rename`Faraday::Request#method` to `#http_method`.
86
114
*Remove`Faraday::Response::Middleware`. You can now use the new`on_complete` callback provided by `Faraday::Middleware`.
87
115
*`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.
89
116
*`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.
0 commit comments