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
I have an edge case where I had to use BytesIO as the data for requests, in production environment, the IO is consumed after the first request, and all subsequent requests read '' as a result. I wanted to reproduce this behavior/issue in tests (for regression tests). However, there seems to be no way to reproduce this behavior.
Currently responses will read and buffer any IO streams that are passed to it, which is why you're not able to reproduce the scenario you're looking to emulate. I don't have a good idea on how we could support both buffered IO objects and un-buffered ones.
Describe the bug
I have an edge case where I had to use BytesIO as the data for requests, in production environment, the IO is consumed after the first request, and all subsequent requests read '' as a result. I wanted to reproduce this behavior/issue in tests (for regression tests). However, there seems to be no way to reproduce this behavior.
Additional context
No response
Version of
responses
0.25.3
Steps to Reproduce
compare the difference in body/data between
python reproduction_test.py
vs
pytest reproduction_test.py
Expected Result
Test passes - the IO object is read/consumed after the first request
The second request body is ``
Actual Result
Test fails.
The second request got the same payload as the initial request.
The text was updated successfully, but these errors were encountered: