cypress: Bug: experimentalFetchPolyfill doesn't handle new Request API
Current behavior:
When constructing a request using fetch’s new experimental polyfill and the new Request
API, we send [object Request]
in the URL’s path. When the experimental polyfill is off, we correctly stringify the URL’s path.
Desired behavior:
Should behave like XHR would when dealing with the new Request
API
Test code to reproduce
In https://github.com/cypress-io/cypress-test-tiny/tree/query-string if you change the ajax.html
fixture to use an example from MDN’s site then you’ll see the above screenshot.
const myHeaders = new Headers();
const myRequest = new Request('flowers.jpg?size=300', {
method: 'GET',
headers: myHeaders,
mode: 'cors',
cache: 'default',
});
fetch(myRequest)
.then(()) => console.log(...arguments))
Versions
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 19 (8 by maintainers)
I have the same problem that @JessicaSachs reported but I’m using ky. Since the native
fetch
support this feature I think that cypress should use a polyfill that supports that too.Gotcha, please follow that issue 8487 to get notified when it gets resolved.
@cainskelton if you are just interested in knowing if a resource has been loaded you can use performance API, see https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/testing-dom__wait-for-resource
Can you work around this using cy.route2? Since this experimental fetch polyfill is a temporary measure, we don’t plan to investigate it or enhance it.