question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: experimentalFetchPolyfill doesn't handle new Request API

See original GitHub issue

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.

Screen Shot 2020-06-29 at 12 36 16 PM

Screen Shot 2020-06-29 at 12 41 22 PM

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
ingrocommented, Sep 2, 2020

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.

1reaction
bahmutovcommented, Sep 22, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Experimental Fetch Polyfill - Cypress
This application presents two challenges to end-to-end tests. First, the data is random - every time the test visits the page localhost:7080 a ......
Read more >
Fetch API requests are not timed - New Relic Explorers Hub
Hello, We are using New Relic Browser to track user behaviour and app performance in our single-page-app. The New Relic Browser agent ...
Read more >
electron-fetch | Yarn - Package Manager
fetch API. Runs on both Electron and Node.js, using either Electron's net module, or Node.js http module as backend. Make conscious trade-off when...
Read more >
ReferenceError: fetch is not defined - javascript - Stack Overflow
If you use the new version(3.0.0) , it will get an error in import and then you'll get another one that says "fetch...
Read more >
Using Fetch
Headers; Response objects; Body; Feature detection; Polyfill; Specifications; Browser compatibility; See also. The Fetch API provides a JavaScript interface for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found