fetch drops session data #15759
              
                Unanswered
              
          
                  
                    
                      jdfadams-msp
                    
                  
                
                  asked this question in
                Docker
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an integration test that logs in to my web app, visits a search page, and tries to search.
Test fragment:
Javascript:
ajax/search.php authenticates the session before searching.
When I run this test in the cypress desktop app, the request arrives at ajax/search.php with session data, and the test passes.
When I run this test in a cypress docker container, the request arrives at ajax/search.php without session data, and the test fails.
When I run this test in a cypress docker container but add
credentials: 'include'to thefetchoptions, the request arrives at ajax/search.php with session data, and the test passes.When I run this test in a cypress docker container but replace
fetchwith equivalent jQuery,the request arrives at ajax/search.php with session data, and the test passes.
Why does the POST via
fetchdrop session data when the test runs in a cypress docker container? Does cypress hook intofetchin such a way that the request appears to be to a different domain?Beta Was this translation helpful? Give feedback.
All reactions