Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I mock the response of my request in chrome dev tool?

I am debugging the frontend issue which only happened in production. I am wondering if there is any way that I can mock the response of request or mock some static file.

For example,

When I call xxx.com, it loads index.html and index.html loads a.js. Since chrome cache the js, is it possible that we can mock the a.js so that index.html will load the mocked a.js?

like image 453
Huaying Tsai Avatar asked Dec 24 '22 01:12

Huaying Tsai


1 Answers

There is no way to mock a server response in devtool itself, but there are some chrome extensions helping with this: I've tried 7 of them, but ( Tweak ) the only one was able to:

  1. intercept needed URL
  2. set the content-type type
  3. set the payload

tweak extension

like image 67
Alexey Nikonov Avatar answered Dec 25 '22 15:12

Alexey Nikonov