Eduardo
Eduardo

Reputation: 63

How to get a custom made response on a request timed out

I'm not able to get my custom 503 response when a request is timed out. I am using the $http service and the timeout config is a promise. This is my plunker.

Upvotes: 0

Views: 56

Answers (1)

Beez
Beez

Reputation: 2101

When you add a promise to the $http object, if it resolves before the request is able to resolve, the response is ABORTED which literally has:

  • Status of "0"
  • No data
  • No status text

There is no 503 response reported "from the server" (from your interceptor) because the request was canceled prior to resolution.

For more information, take a look at this answer.

Upvotes: 1

Related Questions