In my application all server responses are as follows:
response = {
data: {},
status: STATUS_CODE,
message: STRING_MESSAGE
}
I want to use angular's http response function to display a response message for some of my webservices in a toast component. In the interceptor I have a simple response function:
response = function (res) {
console.log(res);
return res;
}
which logs a response object:
{
data:{}, // object response.data
config: {},
status: 200,
statusText: 'OK',
headers: function()
}
There is no message parameter that server sends. Does it mean that interceptor erase some part of my servers response? One of the solutions would be to overwrite a statusText value. I tried to modify server response like
response = {
data: {},
status: STATUS_CODE,
statusText: STRING_MESSAGE
}
but it didn't work, I still had statusText: 'OK' and still no message param in interceptor's response object
dataproperty. That should not be empty object or something is wrong in actual request