You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
(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).
The text was updated successfully, but these errors were encountered:
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 justHTTPClient()
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 thanHTTPClient
).The text was updated successfully, but these errors were encountered: