In chrome developer tools is very useful to "replay xhr" for a xhr request (network tab). I have started using fetch in my code, and chrome developer tools do not allow to "replay" a fetch request, how is can it be? Am I doing something wrong?
how to replay a fetch in chrome developer tools
Asked Answered
Not yet implemented, apparently: crbug.com/573371 –
Burris
FWIW unless you utilize the ability to process data streams, what features of Fetch API do you need that you can't have in a promisified XHR? Also I don't like there's no way to cancel a fetch request. –
Burris
What else do you use? I could promisify xhr but since there's fetch and it's a standard in browser I thought was a good idea to use it. Before I was using angular $http and before that jquery.ajax, but now I moved to reactjs and thought fetch is a good substitute. –
Imprimis
@wOxxOm wow, can't believe it –
Imprimis
Well, seems it's not supported yet. It's a real disappointment because "replay" is just too useful to stop using it.
So I followed @wOxxOm advice and I just created a promised version of the standard xhr: https://github.com/max-favilli/helper-xhr
That's so bad, why on earth they don't let replay fetch requests –
Energetic
I would rather remove the fetch from window and replace it with fetch polyfill that uses xhr –
Basuto
It's not ideal, but you can right-click on the request, select copy -> "copy as fetch", then paste and execute in the console. Why can't that happen with a single click in the context menu (in 2024)? idk.
If I do that I get a pending Promise in the console –
Astoria
@Astoria yea but the request will show up in the network tab –
Dibri
© 2022 - 2025 — McMap. All rights reserved.