javascript - Force Http status when requesting a particolar html page in Angular js -


there way in angular force http status code after requesting particolar html page?

i want force 404 status when requesting page particolar url example: https://www.example.com/path/path?query=3.com

not sure if can retrieve requested url int response in $http interceptor.

try this:

mymodule.factory('myhttpinterceptor', function ($q) {     return {         response: function (response) {             if (response.url === "http://test.com")                response.status = 404;             return response;         }     }; });   mymodule.config(function ($httpprovider) {     $httpprovider.interceptors.push('myhttpinterceptor'); }); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -