Support streaming API
Hi, first of all, let me say this is a great library, and I've loved using it so far.
I have a use-case where I need to test a streaming API from ChatGPT. Does this library support streaming responses?
I couldn't find anything in the docs, so just checking here. Thanks!
hi @hemandev ,
Thanks! 🙏
For the first sight, you could try using implementing your own response handler, which is a function accepting a request object and returning a response object.
https://pytest-httpserver.readthedocs.io/en/latest/howto.html#using-custom-request-handler
Here, the Response object is provided by werkzeug: https://werkzeug.palletsprojects.com/en/3.0.x/wrappers/#werkzeug.wrappers.Response
...which allows you to specify an iterable object as response body.
I haven't made a PoC for this for this yet, but I'd suggest trying this.
Hope it helps,
Zsolt