Skip to content

Commit

Permalink
* Remove retry middleware and all its documentation and tests.
Browse files Browse the repository at this point in the history
* Remove references to deprecated FaradayMiddleware from documentation.
  • Loading branch information
iMacTia committed Jan 2, 2022
1 parent c9b8490 commit b7fd5f8
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 685 deletions.
12 changes: 6 additions & 6 deletions UPGRADING.md
Expand Up @@ -37,12 +37,12 @@ We did our best to make this transition as painless as possible for you, so here
`faraday` altogether as these gems usually have Faraday already in their dependencies.
* If you're relying on `Faraday.default_adapter` (e.g. if you use `Faraday.get` or other verb class methods, or not
specifying an adapter in your connection initializer), then you'll now need to set it yourself. It previously
defaulted to `:net_http`, but it now defaults to `:test`. You can do so simply by using the setter:
defaulted to `:net_http`, but it now requires to be explicitly set. You can do so simply by using the setter:

```ruby
# For example, to use net_http (previous default value, will now require `gem 'faraday-net_http'` in your gemfile)
Faraday.default_adapter = :net_http
```
```ruby
# For example, to use net_http (previous default value, will now require `gem 'faraday-net_http'` in your gemfile)
Faraday.default_adapter = :net_http
```

### Faraday Middleware Deprecation

Expand Down Expand Up @@ -86,7 +86,7 @@ For more details, see https://github.com/lostisland/faraday/pull/1306
* Remove `Faraday::Response::Middleware`. You can now use the new `on_complete` callback provided by `Faraday::Middleware`.
* Drop `Faraday::UploadIO` in favour of `Faraday::FilePart`.
* `Faraday.default_connection_options` will now be deep-merged into new connections to avoid overriding them (e.g. headers).
* Retry middleware `retry_block` is not called if retry will not happen due to `max_interval`. (#1350)
* Retry middleware has been moved to a separate `faraday-retry` gem.
* `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.

## Faraday 1.0
Expand Down
4 changes: 0 additions & 4 deletions docs/index.md
Expand Up @@ -37,15 +37,11 @@ Or install it yourself as:
$ gem install faraday
```

You can also install the [`faraday_middleware`][faraday_middleware]
extension gem to access a collection of useful Faraday middleware.

{: .mt-60}

{: .text-center}
[<i class="fas fa-fw fa-book-open"> </i> Read the docs][usage]{: .btn}

[github]: https://github.com/lostisland/faraday
[gitter]: https://gitter.im/lostisland/faraday
[faraday_middleware]: https://github.com/lostisland/faraday_middleware
[usage]: ./usage
14 changes: 8 additions & 6 deletions docs/middleware/index.md
Expand Up @@ -25,13 +25,15 @@ To use these great features, create a `Faraday::Connection` with `Faraday.new`
and add the correct middleware in a block. For example:

```ruby
require 'faraday_middleware'
require 'faraday'
require 'faraday/net_http'
require 'faraday/retry'

conn = Faraday.new do |f|
f.request :json # encode req bodies as JSON
f.request :retry # retry transient failures
f.response :follow_redirects # follow redirects
f.response :json # decode response bodies as JSON
f.adapter :net_http # Use the Net::HTTP adapter
end
response = conn.get("http://httpbingo.org/get")
```
Expand Down Expand Up @@ -64,7 +66,7 @@ For example, the `Faraday::Request::UrlEncoded` middleware registers itself in
# Faraday::Response and Faraday::Adapter registries
conn = Faraday.new do |f|
f.request :url_encoded
f.response :follow_redirects
f.response :logger
f.adapter :httpclient
end
```
Expand All @@ -75,7 +77,7 @@ or:
# identical, but add the class directly instead of using lookups
conn = Faraday.new do |f|
f.use Faraday::Request::UrlEncoded
f.use FaradayMiddleware::FollowRedirects
f.use Faraday::Response::Logger
f.use Faraday::Adapter::HTTPClient
end
```
Expand All @@ -84,7 +86,7 @@ This is also the place to pass options. For example:

```ruby
conn = Faraday.new do |f|
f.request :retry, max: 10
f.request :logger, bodies: true
end
```

Expand All @@ -93,7 +95,7 @@ end
The [Awesome Faraday](https://github.com/lostisland/awesome-faraday/) project
has a complete list of useful, well-maintained Faraday middleware. Middleware is
often provided by external gems, like the
[faraday-middleware](https://github.com/lostisland/faraday_middleware) gem.
[faraday-retry](https://github.com/lostisland/faraday-retry) gem.

We also have [great documentation](list) for the middleware that ships with
Faraday.
Expand Down
5 changes: 1 addition & 4 deletions docs/middleware/list.md
Expand Up @@ -29,8 +29,6 @@ multipart form request.
* [`UrlEncoded`][url_encoded] converts a `Faraday::Request#body` hash of key/value pairs into a url-encoded request body.
* [`Json Request`][json-request] converts a `Faraday::Request#body` hash of key/value pairs into a JSON request body.
* [`Json Response`][json-response] parses response body into a hash of key/value pairs.
* [`Retry`][retry] automatically retries requests that fail due to intermittent client
or server errors (such as network hiccups).
* [`Instrumentation`][instrumentation] allows to instrument requests using different tools.


Expand All @@ -47,8 +45,7 @@ before returning it.
[multipart]: ./multipart
[url_encoded]: ./url-encoded
[json-request]: ./json-request
[retry]: ./retry
[instrumentation]: ./instrumentation
[json-response]: ./json-response
[json-response]: ./json-response
[logger]: ./logger
[raise_error]: ./raise-error
4 changes: 2 additions & 2 deletions docs/middleware/request/instrumentation.md
Expand Up @@ -3,8 +3,8 @@ layout: documentation
title: "Instrumentation Middleware"
permalink: /middleware/instrumentation
hide: true
prev_name: Retry Middleware
prev_link: ./retry
prev_name: JSON Request Middleware
prev_link: ./json-request
next_name: JSON Response Middleware
next_link: ./json-response
top_name: Back to Middleware
Expand Down
4 changes: 2 additions & 2 deletions docs/middleware/request/json.md
Expand Up @@ -5,8 +5,8 @@ permalink: /middleware/json-request
hide: true
prev_name: UrlEncoded Middleware
prev_link: ./url-encoded
next_name: Retry Middleware
next_link: ./retry
next_name: Instrumentation Middleware
next_link: ./instrumentation
top_name: Back to Middleware
top_link: ./list
---
Expand Down
126 changes: 0 additions & 126 deletions docs/middleware/request/retry.md

This file was deleted.

7 changes: 3 additions & 4 deletions docs/usage/index.md
Expand Up @@ -156,18 +156,17 @@ To use these great features, create a `Faraday::Connection` with `Faraday.new`
and add the correct middleware in a block. For example:

```ruby
require 'faraday_middleware'
require 'faraday'
require 'faraday/retry'

conn = Faraday.new('http://httpbingo.org') do |f|
f.request :json # encode req bodies as JSON and automatically set the Content-Type header
f.request :retry # retry transient failures
f.response :follow_redirects # follow redirects (3xx HTTP response codes)
f.response :json # decode response bodies as JSON
f.adapter :net_http # adds the adapter to the connection, defaults to `Faraday.default_adapter`
end

# Sends a GET request with JSON body that will automatically retry in case of failure
# and follow 3xx redirects.
# Sends a GET request with JSON body that will automatically retry in case of failure.
response = conn.get('get', boom: 'zap')

# response body is automatically decoded from JSON to a Ruby hash
Expand Down
8 changes: 1 addition & 7 deletions lib/faraday/error.rb
Expand Up @@ -141,13 +141,7 @@ class ConnectionFailed < Error
class SSLError < Error
end

# Raised by FaradayMiddleware::ResponseMiddleware
# Raised by middlewares that parse the response, like the JSON response middleware.
class ParsingError < Error
end

# Exception used to control the Retry middleware.
#
# @see Faraday::Request::Retry
class RetriableResponse < Error
end
end
1 change: 0 additions & 1 deletion lib/faraday/request.rb
Expand Up @@ -134,5 +134,4 @@ def to_env(connection)
require 'faraday/request/instrumentation'
require 'faraday/request/json'
require 'faraday/request/multipart'
require 'faraday/request/retry'
require 'faraday/request/url_encoded'

0 comments on commit b7fd5f8

Please sign in to comment.