-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
topic: cy.intercept()type: unexpected behaviorUser expected result, but got anotherUser expected result, but got another
Description
Current behavior
When sending request with cyrillic strings in json data to url, stubbed by cy.intercept, request.body object is ArrayBuffer, not plain object.
// intercept some url with any data
cy.intercept(URL, {
body: { result: 'ok' },
}).as('testRequest');
// send json request with cyrillic string in data (length must be more than 6)
sendRequest({name: "Фрауиванович"})
cy.wait('@testRequest')
.its('request')
.then((req) => {
console.log(req.body); // is ArrayBuffer object, not plain object
});
// send json request without cyrillic in data
sendRequest({name: "FrausIvanovich"})
cy.wait('@testRequest')
.its('request')
.then((req) => {
console.log(req.body); // is plain object, as expected
});Desired behavior
When sending request with cyrillic strings in json data to url, stubbed by cy.intercept, request.body is plain object
// send json request with cyrillic string in data (length must be more than 6)
sendRequest({name: "Фрауиванович"})
cy.wait('@testRequest')
.its('request')
.then((req) => {
console.log(req.body); // is plain object
});Test code to reproduce
Test code to reproduce: https://github.com/KarKarbI4/cypress-cyrillic-intercept-issue/blob/main/cypress/integration/spec.js
Test repo: https://github.com/KarKarbI4/cypress-cyrillic-intercept-issue
Versions
Cypress: cypress@7.1.0, cypress@7.2.0
Browser: Google Chrome 90
OS: MacOS Big Sur 11.2.3
Metadata
Metadata
Assignees
Labels
topic: cy.intercept()type: unexpected behaviorUser expected result, but got anotherUser expected result, but got another