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
Check request body using cy.route2() #8695
Comments
Thanks for reporting this @Cesaario. This appears to be the "request" counterpart to the unexpected behavior reported here: #8536 As a workaround, you can intercept the request on the browser-side. This will cause the request body to be sent to the browser. it('Using cy.route2()', () => {
// stub via request interceptor to get body sent to driver
cy.route2(method, '**', (req) => { req.reply({}) }).as('Route2');
cy.get('#client_method').select(method);
cy.get('#client_postdata').type("test");
cy.get('#btnSendRequest').click();
cy.wait('@Route2').then(req => {
console.log(req);
cy.wrap(req.request).its('body').should('contain', 'test');
})
}) |
The code for this is done in cypress-io/cypress#8739, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
When I use cy.wait('@test') to check the request that was mocked using cy.route2(), it does not contain a request body.

Desired behavior
I expected a behavior similar to the one using cy.route().

Test code to reproduce
Versions
Cypress 5.3.0
Windows 10
Chrome 85
The text was updated successfully, but these errors were encountered: