New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default implementation of Middleware#close
.
#1069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this will go well with Faraday::RackBuilder#close
and Faraday::Connection#close
, so a user can call it easily from their app.
I would like some tests to go along with this:
- Test that Middleware can implement
#close
- Test that an Adapter can implement
#close
Thank you @ioquatix, this is exactly the implementation I was thinking about and it totally make sense. Agree with @technoweenie that we need to check if The only problem with this implementation is that we're assuming all middleware inherit from If we're happy with that, we can polish this PR, add some tests and update the documentation, but that's one of the reasons why I initially left it for v2.0 (where the plan is to make backwards-incompatible changes and force things like all middleware to inherit) |
I agree, a silent fail on |
One option would be to make it a documented requirement for 1.0, and we can make it a warning if it doesn’t exist. That way we don’t break existing code but people are aware it’s wrong. |
I like this, as this will only come up if a developer tries to call |
Okay, I think this should be okay now? It's the bare minimum required I guess. It's such a simple interface... I probably don't recommend adding a module for it unless you can roll it into other life-cycle related behaviour. |
This looks good, but how do you actually plan to use it? If this merges, I think you'll have to call something like |
Oh I just assumed connection was a kind of middleware, okay ill need to expose that too. |
I don't know how to fix:
|
@ioquatix thanks for continuing to work on this! Change Line 16 in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All feedback has been met with an implementation and a plan ahead.
I think we are ready for this!
Thanks for your help! |
I am waiting for airplane so this is brief just to start the conversation around how this should work.
#241