cy.intercept is always returning an empty body #15361
              
                Unanswered
              
          
                  
                    
                      james-begg
                    
                  
                
                  asked this question in
                Component Testing
              
            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'm trying to intercept a locally served asset on an Angular project - simple config.json file. Doing a simple:
cy.intercept('GET', '**/assets/config/config.json', (req) => console.log(req.body));gives me a null response, despite the fact that it recognises the request being sent, and the headers are there.Here is the console log from this - no body despite there being a JSON recieved.

As you can see the request is being recieved

Does anyone know why this empty body is being returned and not the JSON file?
Beta Was this translation helpful? Give feedback.
All reactions