Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulating an error code in Chrome dev tools

From the dev tools, is it possible to tell Chrome to return, for example, a 404 when a specific url is requested (leaving other requests to process normally)?

like image 912
csvan Avatar asked Sep 10 '17 11:09

csvan


2 Answers

You can block specific request URLs or patterns of URLs from the Network panel.

block request URL

Manage your blocked URLs from the Request Blocking tab.

Request Blocking tab

Official feature announcement: https://developers.google.com/web/updates/2017/04/devtools-release-notes#block-requests

like image 120
Kayce Basques Avatar answered Nov 18 '22 22:11

Kayce Basques


Blocking the request with chrome devtools is the easiest solution. But if you want to mock a specific error code, let say 401 or 404 you can use a chrome extension to do it. There are plenty of them in the store, I just tried one randomly and it allowed me to mock a specific error code https://chrome.google.com/webstore/detail/mokku-mock-api-calls-seam/llflfcikklhgamfmnjkgpdadpmdplmji?hl=en

like image 4
Liem Avatar answered Nov 18 '22 22:11

Liem