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

Move the default agent behavior to HTTPClient #143

Open
Julian opened this issue Oct 30, 2016 · 0 comments
Open

Move the default agent behavior to HTTPClient #143

Julian opened this issue Oct 30, 2016 · 0 comments

Comments

@Julian
Copy link
Member

Julian commented Oct 30, 2016

If you have an object which wishes to make HTTP requests but allow for injecting an alternate object (for testing or customization purposes, say injecting a StubTreq), HTTPClient is seemingly the right place to do so.

It would be nice if the treq behavior to automatically use the global agent was moved to this layer rather than up in treq.api, so that one could default to just HTTPClient() and not need to poke at additional treq internals.

Specifically, it would be nice I think if https://github.com/twisted/treq/blob/master/treq/api.py#L114-L122 was part of HTTPClient's defaults.

(And for anyone finding this, in the meantime, what I think is the thing to do is to instead have objects get treq.request injected into them rather than HTTPClient).

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

1 participant