Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide http status code warning at chrome developer console

So, I have a rest api developed in Express. For authentication, I'm using cookies and to fetch user info I just do a get request to an endpoint that return me user info if its logged in or a 401 (Unauthorized) status code if its not. My concern is about, when I get a 401 status code, the chrome developer console print

Failed to load resource: the server responded with a status of 401 (Unauthorized)

It does not cause any bug in the client, just that It bothers me to see it hah.

like image 645
Leonardo Emilio Dominguez Avatar asked Sep 02 '25 15:09

Leonardo Emilio Dominguez


1 Answers

Create an interceptor in the HTTP requests and upon received response, use the single line code console.clear(); to clear the console output.

In that way, even if you receive 401 or 403 or any response from server and a console error/warning is auto generated, then it will be auto cleared as well!

like image 88
Ravi Maniyar Avatar answered Sep 05 '25 05:09

Ravi Maniyar