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
Post a Comment