Skip to content
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

Merged
merged 4 commits into from
Oct 22, 2020

Conversation

iMacTia
Copy link
Member

@iMacTia iMacTia commented Oct 22, 2020

Description

  • Introduces on_request and on_complete methods in Faraday::Middleware
  • Adds documentation on how to leverage the new methods

Additional Notes

Unit tests for on_complete were a bit complicated to write as they rely on the callback system of the Rack::Builder.
It would be better to write integration tests for that, but given the limited amount of time I couldn't make it today.

Adds documentation on how to leverage the new methods.
Copy link
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎂

@iMacTia iMacTia merged commit d56742a into master Oct 22, 2020
@iMacTia iMacTia deleted the easy-middleware branch October 22, 2020 14:04

### 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`.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES 🙈

Copy link
Member Author

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

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. 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants