-
Notifications
You must be signed in to change notification settings - Fork 979
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Middleware DEFAULT_OPTIONS with Application and Instance Co…
…nfigurability (#1572)
- Loading branch information
1 parent
1958cb1
commit d83a281
Showing
7 changed files
with
308 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
module FaradayMiddlewareSubclasses | ||
class SubclassNoOptions < Faraday::Middleware | ||
end | ||
|
||
class SubclassOneOption < Faraday::Middleware | ||
DEFAULT_OPTIONS = { some_other_option: false }.freeze | ||
end | ||
|
||
class SubclassTwoOptions < Faraday::Middleware | ||
DEFAULT_OPTIONS = { some_option: true, some_other_option: false }.freeze | ||
end | ||
end | ||
|
||
Faraday::Response.register_middleware(no_options: FaradayMiddlewareSubclasses::SubclassNoOptions) | ||
Faraday::Response.register_middleware(one_option: FaradayMiddlewareSubclasses::SubclassOneOption) | ||
Faraday::Response.register_middleware(two_options: FaradayMiddlewareSubclasses::SubclassTwoOptions) |