Skip to content
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

Post requests are sent without a json body #30914

Open
Avcajaraville opened this issue Jan 18, 2025 · 1 comment
Open

Post requests are sent without a json body #30914

Avcajaraville opened this issue Jan 18, 2025 · 1 comment

Comments

@Avcajaraville
Copy link

Current behavior

When writing e2e tests, connecting to a real server, doing a POST request sends an empty json body and headers are not correct.

These are the headers in cypress using electron:
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7

The server doesn't receives a body payload neither.

Screenshot of the headers in electron when running cypress
Image

Network panel for POST /login request
Image

Server response
Image

Desired behavior

Cypress should not change request header and should send json body payload.

Screenshot of the request in firefox when using the app without cypress

Image

Headers for the post request

Image

Test code to reproduce

This is the cypress test file that we are using:

describe('Login page', () => {
  const email = 'e2e@testing.com';
  const password = 'password';

  it('should succesfully log in the app and redirects to transactions page', () => {
    cy.visit('/login');
    cy.get('#email').type(email);
    cy.get('#password').type(password);
    cy.get('[data-testid="login-form"]').submit();
    cy.location('pathname').should('eq', '/transactions')
  });
});

Cypress Version

14.0.0

Node version

22.11.0

Operating System

Windows 11 PRO. Using ubuntu 22.04.2 LTS inside WSL2 with XLaunch

Debug Logs

Other

Note that we are actually connecting to a real server with real database, so the test we are writing is not mocked in any way, nor the requests are intercepted.

@Avcajaraville
Copy link
Author

I test this issue outside of the WSL2 echosystem, now on a Mac, and seems to be working fine... But our main machines are windows... so it is a weird bug...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant