question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

responses 0.15.0 not setting cookies

See original GitHub issue

Environment

responses 0.15.0

Steps to Reproduce

from unittest import TestCase

from requests import Session
from requests.adapters import HTTPAdapter
import responses
from urllib3.util.retry import Retry


class TestSession(TestCase):

  @responses.activate
  def test_cookies_enabled_on_session(self):
    responses.add(responses.GET, "http://test.com", body="resp", status=200, headers={"set-cookie": "foo=bar"})
    sess = Session()
    retries = 1
    retry = Retry(
        total=retries,
        read=retries,
        connect=retries,
        status=retries,
        backoff_factor=0.1,
        status_forcelist=frozenset([500, 502, 504]),
    )
    adapter = HTTPAdapter(max_retries=retry)
    sess.mount("http://", adapter)
    sess.mount("https://", adapter)
    resp = sess.get("http://test.com")
    assert resp.text == "resp" # True
    assert sess.cookies.get("foo") == "bar" # False, should be True

Run above with pytest.

Expected Result

With 0.14.0, the above test passes, which is the expected result (cookies should be set).

Actual Result

In 0.15.0, the above test fails as the cookie are not set.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
beliaev-maksimcommented, Nov 17, 2021

@chadwhitacre fixed on latest master and should be in 16.0 image

0reactions
beliaev-maksimcommented, Nov 17, 2021

@chadwhitacre would be glad to, but I have not 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sails not setting cookie on CORS login · Issue #5629 - GitHub
I am trying to do a login request, and save the session cookie. This works if I host the client app on the...
Read more >
set-cookie header not working - Stack Overflow
I'm running the server on localhost, with 127.0.0.1 aliased to subdomain-dev.domain.com on port 5080 . My When I receive the response for my ......
Read more >
Upgrading to 0.15.0 | dbt Developer Hub
The dbt v0.15.0 release contains a handful of breaking code changes for users upgrading from v0.14.0.
Read more >
pytest-httpx - PyPI
Cookies are sent in the set-cookie HTTP header. You can then send cookies in the response by setting the set-cookie header with the...
Read more >
bitnami/jmx-exporter:0.15.0-debian-10-r59 - Docker Hub
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found