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
responses, is modifying PreparedRequest instances to incorporate additional attributes.
This is fine in the context of responses, this is not however when this data is returned to the clients.
Could you modify responses so that the behavior from a client perspective is the one of requests (ie: no additional attributes in objects) ?
Thanks again
Additional context
In the context of writing tests against HTTP behavior that cannot be reproduced with a real live scenario (such as an HTTP failure response from the server), I am trusting my test suite to be able to handle those scenarios and if I see that a PreparedRequest contains an attribute, I assume it will exists in production code as well the day such issue will occur (could be years after deployment time in such scenarios).
Version of responses
0.25.3
Steps to Reproduce
importrequestsimportresponsesdeftest_params_in_prepared_request():
responses.get("https://the_test.url", status=403)
response=requests.get("https://the_test.url?param=value")
try:
response.raise_for_status()
exceptrequests.RequestExceptionase:
print(e.request.params) # Without responses, an AttributeError will be raise ('PreparedRequest' object has no attribute 'params')
Expected Result
I expect the same failure as in production in my test run
Actual Result
The AttributeError is not raised when accessing params on a PreparedRequest
The text was updated successfully, but these errors were encountered:
Describe the bug
As you can see in
responses/responses/__init__.py
Line 1067 in b68e513
This is fine in the context of responses, this is not however when this data is returned to the clients.
Could you modify responses so that the behavior from a client perspective is the one of requests (ie: no additional attributes in objects) ?
Thanks again
Additional context
In the context of writing tests against HTTP behavior that cannot be reproduced with a real live scenario (such as an HTTP failure response from the server), I am trusting my test suite to be able to handle those scenarios and if I see that a PreparedRequest contains an attribute, I assume it will exists in production code as well the day such issue will occur (could be years after deployment time in such scenarios).
Version of
responses
0.25.3
Steps to Reproduce
Expected Result
I expect the same failure as in production in my test run
Actual Result
The AttributeError is not raised when accessing params on a PreparedRequest
The text was updated successfully, but these errors were encountered: