-
Notifications
You must be signed in to change notification settings - Fork 60
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
Middleware: Provide EVEN MORE information to default_value handle #48
Comments
Actually I feel like this is already possible to get at with the current setup require "faraday"
connection = Faraday.new(url: "http://example.com")
response = connection.get "/"
response.env.url will give you the url, as the response is linked back to the environment in faraday. Does this help? In general I'm open to extending this as needed if there is more you need to get at, feel free to submit a PR :). Thanks for the feedback by the way, if my response is actually what you need I guess some addition to the readme would be in order. |
Timely reply. So that would work if I did indeed get a response back. But what about the cases where it raised an error, like timeouts? I would still need the env/request right? |
So, let me play with this a bit. I believe I can hook into |
Yes indeed in case of a timeout response would be |
@sideshowcoder Here is what I came up with. I am almost certain some patterns here are not the concern of this gem. But I did want to show where my head was and potential use cases. This implementation assumes:
|
Looks good, I really like the idea. The one thing I think that needs some investigation is if the injection in the open method would mess with the retry logic in circuitbox, I think not but am not completely confident in it so I think it warrants some extensive testing in this area. Other than that seems like something I would love to provide support for with circuitbox. |
So #35 added the error to the default value proc. In my work, I want the identifier so I can use that key to get a response from my cache. Would you be open to a pull request for this?
My thoughts would be to pass the
env
so I could just ask it for the URL. Are there other ways? Has anyone else been interested in making the default value a previous cached request?cc @dwaller
The text was updated successfully, but these errors were encountered: