Cookie handling regression from 0.14.0 to 0.15.0
See original GitHub issueEnvironment
Using the responses library under Python 3.9.7
Steps to Reproduce
Run this test against responses 0.14.0 and against responses 0.15.0
#!/usr/bin/env python3
import sys
import requests
import responses
def main():
with responses.RequestsMock() as fakes:
fakes.add(responses.GET, 'https://example.com', status=200,
adding_headers=[
('Set-Cookie', 'mycookie=myvalue; path=/; secure'),
],
body="Returned body",
)
session = requests.session()
response = session.get('https://example.com')
tests = {}
tests['response-cookie'] = 'mycookie' in response.cookies
tests['session-cookie'] = 'mycookie' in session.cookies
failures = 0
for testname, result in tests.items():
if not result:
failures += 1
sys.stdout.write(f"Test {testname} result {result}\n")
if failures:
sys.stdout.write(f"{failures} of {len(tests)} failed.\n")
else:
sys.stdout.write(f"All {len(tests)} tests passed.\n")
return 1 if failures else 0
if __name__ == '__main__':
sys.exit(main())
Expected Result
Expected ‘mycookie’ to appear in both the response.cookies and the session.cookies
Actual Result
‘mycookie’ appears in both the response.cookies and the session.cookies for 0.14.0 ‘mycookie’ appears in the response.cookies but not in the session.cookies for 0.15.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:25 (11 by maintainers)
Top Results From Across the Web
Changelog - encode/httpx - GitHub
Regression in 0.21.2. ... 0.15.0 (September 22nd, 2020) ... Handling multiple Set-Cookie headers became broken in the 0.14.0 release, ...
Read more >Release Notes - Kolibri developer documentation
This release fixes a regression with quiz display for non-admins. Fixed¶. Clean up state management for user management page in https://github.com/ ...
Read more >Effect Size in Statistics - The Ultimate Guide - SPSS tutorials
Quick guide to which effect size you must use for which test and how to get it. Includes rules of thumb for small,...
Read more >Release Notes - Starlette
0.15.0. June 23, 2021. This release includes major changes to the low-level asynchronous parts of Starlette. As a result, Starlette now depends on...
Read more >Changelog | Data Flow Graph | 0.15.0-preview.5
[0.15.0-preview.4] - 2020-06-10. Fixed. Fix regression where post-processing would crash on NodeDefinition 's who's INodeData , ISimulationPortDefinition ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Release for 0.16 is scheduled. https://github.com/getsentry/responses/actions/runs/1449966071
I suspect the issue may be the removal of the
response.close()
call inRequestsMock._on_request
, but I’m not sure.