I am trying to implement an interceptor for my server responses (PARSE) with angularjs, I have seen this project that uses the $httpProvider to register the interceptor.
since my service is not using $http service (is using PARSE), is there any way of implement my interceptor in the same clean way that the project sample?
Instead of using Parse
service, I'd think of call parse.com
API by using $http
service only just we need to pass certain headers like X-Parse-Application-Id
& X-Parse-REST-API-Key
so that you could write your own interceptor that would have an control & watch over the request/response.
Code
$http({method : 'GET',
url: 'https://api.parse.com/XXXXXXX',
headers: { 'X-Parse-Application-Id':'YYYYYYYYYYYY',
'X-Parse-REST-API-Key': 'ZZZZZZZZZZZZ'}
})
.success(function(data){})
.error(function(err){});
Inspired from this answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With