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

Add support for interceptors #89

Closed
tvolkert opened this issue Jun 22, 2017 · 2 comments
Closed

Add support for interceptors #89

tvolkert opened this issue Jun 22, 2017 · 2 comments

Comments

@tvolkert
Copy link
Contributor

Apps often employ some form of inversion of control, and network layer APIs often see the biggest use cases for this pattern, where apps want to register things like "whenever an HTTP request goes out, give me a hook into it (to mutate or outright replace it)" The same goes for inbound responses.

I suggest we add support for request & response interceptors, where callers can register themselves to form an interceptor chain.

@nex3 if you're open to the idea, I'll write up a more detailed design proposal.

@nex3
Copy link
Member

nex3 commented Jun 22, 2017

This is actually a core feature of the package! It was designed to be possible to create a Client subclass that wraps another Client and adds behavior like you're describing—see the http_throttle package for an example.

The API is currently not super nice, but @donny-dont is working on a major refactor that's dramatically improving it. You can see the progress on the master branch.

@OperKH
Copy link

OperKH commented Dec 3, 2018

You should look on Dio - it supports interceptors.
https://pub.dartlang.org/packages/dio

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

No branches or pull requests

3 participants