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

support files= in StubTreq #250

Open
glyph opened this issue Jul 22, 2019 · 1 comment
Open

support files= in StubTreq #250

glyph opened this issue Jul 22, 2019 · 1 comment

Comments

@glyph
Copy link
Member

glyph commented Jul 22, 2019

Currently if you specify a files= argument to StubTreq, it complains that this is not supported.

The reason it's not supported is that HTTPClient.request, when given a files= argument, will construct a treq.multipart.MultiPartProducer without giving it a cooperator= argument; the default value for cooperator= is twisted.internet.task, which populates MultiPartProducer._cooperate with twisted.internet.task.cooperate, which implicitly references the global reactor.

It should be possible to push down a Cooperator object through HTTPClient so that the instantiated MultiPartProducer can use the passed in one. (Given that Cooperator is itself a stateful scheduler, it's not quite enough just to pass an IReactorTime.)

@glyph
Copy link
Member Author

glyph commented Jul 26, 2019

Related: #161

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