Closed logileifs closed 5 years ago
Hi @logileifs
I like the idea, please open a PR with this feature :)
The only missing thing I see in your snippet is that the argument headers
in open()
is ignored. I'd say that the headers in the open should be merged with the client headers, so you can use the client headers to "inherit" when doing a request with other headers. What do you think?
Yeah that sounds good, I'll submit a pull request tomorrow if I have enough time, otherwise in the coming days
Hi there and thanks for a great test client! It really saved me since Starlette's default TestClient is so awful.
But would it be possible to provide a nicer way to send headers with each request. For example with requests you can do:
I couldn't find any similar functionality in your otherwise excellent testing client so I resorted to subclassing your TestClient like this:
Is there maybe some better way of doing this that I am missing? Or would you be willing to add a similar feature? I can also open a pull request if you are open to that