-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Requesting a URL, then changing the response will return the old response #212
Comments
It seems, the feature got broken around 0.6.1 release. It is working on 0.6.0. |
@niksite This is interesting, I went back to commit 4c90391 (which is part of version 0.5.0) and still saw this behavior. If you have a 0.6.0 environment that does not expose it, could you share the versions of other packages installed ( I used this script to test, but without a known good revision it's not possible to bisect: import sys
try:
import responses
import requests
responses.start()
responses.add(responses.GET, "https://example.com/",
json={'response': 'old'}
)
assert b'{"response": "old"}' == requests.get('https://example.com/').content
responses.add(responses.GET, "https://example.com/",
json={'response': 'new'}
)
response = requests.get('https://example.com/')
if b'{"response": "new"}' == response.content:
sys.exit(0)
else:
print('Got response %r' % response.content)
sys.exit(1)
except Exception as e:
print(e)
sys.exit(125) |
For me, in some situations the interleaving works fine and in others I get the error described here. This was driving me crazy... I'm surprised the bug exists 2 years later. |
The documentation states:
However, this is not true if you interleave adding and requesting responses:
Expected result: After adding the "new" response, a "new" response is returned in the subsequent request.
Requests version: '2.19.1', Python 3.6.6
The text was updated successfully, but these errors were encountered: