Reputation: 9464
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)?
Upvotes: 35
Views: 33467
Reputation: 770
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
Upvotes: 8
Reputation: 26017
You can block specific request URLs or patterns of URLs from the Network panel.
Manage your blocked URLs from the Request Blocking tab.
Official feature announcement: https://developers.google.com/web/updates/2017/04/devtools-release-notes#block-requests
Upvotes: 44