how to replay a fetch in chrome developer tools
Asked Answered
I

2

19

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?

Imprimis answered 20/3, 2017 at 16:28 Comment(4)
Not yet implemented, apparently: crbug.com/573371Burris
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 itImprimis
I
14

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

Imprimis answered 22/3, 2017 at 13:3 Comment(2)
That's so bad, why on earth they don't let replay fetch requestsEnergetic
I would rather remove the fetch from window and replace it with fetch polyfill that uses xhrBasuto
D
0

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.

Dibri answered 1/3, 2024 at 20:53 Comment(2)
If I do that I get a pending Promise in the consoleAstoria
@Astoria yea but the request will show up in the network tabDibri

© 2022 - 2025 — McMap. All rights reserved.