-
Notifications
You must be signed in to change notification settings - Fork 982
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
Introduces on_request and on_complete methods in Faraday::Middleware. #1194
Conversation
Adds documentation on how to leverage the new methods.
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.
🎂
|
||
### Do I need to override `#call`? | ||
|
||
For the majority of middleware, it's not necessary to override the `#call` method, as you can simply use `#on_request` and `#on_response`. |
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.
This on_response should be on_complete, right?
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.
YES 🙈
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.
Luckily, that was already spot and fixed 🙌
4e9f4b0
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.
Oh nice! I was just reading through the PRs referenced in the release notes. I didn't think to diff the two versions. 😬
Description
on_request
andon_complete
methods inFaraday::Middleware
Additional Notes
Unit tests for
on_complete
were a bit complicated to write as they rely on the callback system of theRack::Builder
.It would be better to write integration tests for that, but given the limited amount of time I couldn't make it today.