`cy.intercept` request.body is ArrayBuffer for JSON requests with long Cyrillic strings
See original GitHub issueCurrent 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
intercept - Cypress Documentation
Spy and stub network requests and responses. ... See "Intercepted requests" and Request/Response Modification with ... Stub a response with a JSON body:....
Read more >Cypress 9.6.0 - response returned from cy.request has a body ...
The issue is that instead of an ArrayBuffer I should be getting normal JSON format response (ofc during the test in the app...
Read more >Software-Pakete in »bionic«, Unterbereich web - Ubuntu
JavaScript utility for merging multiple objects into one. libjs-microplugin.js (0.0.3+dfsg-1) [universe]: Lightweight plugin / dependency system for libraries ...
Read more >Falcon Sandbox v8.48.12 © Hybrid Analysis
Sets a global windows hook to intercept mouse events ... DNS Requests. Login to Download DNS Requests (CSV) ... Download All Memory Strings...
Read more >cypress-intercept-formdata-identt - npm
This package is intended to be used with Cypress.io intercept command. As of version 6.2 or 6.3 the request.body accessed from the intercept...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I submited PR at https://github.com/bevry/istextorbinary/pull/214. It’s now awaiting external fix.
The example you gave would ‘sometimes fail’ the other assertions because the requests were being made synchronously, so sometimes the 3rd definition had already run by the time the first wait ran.
Regardless, the last test below will always reliably fail, as the response is an ArrayBuffer when the response data is
Фраусиванович
. Seems unexpected to me.