Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($http) Indicate whether a request was aborted via status. #4491

Closed
@jgrund

Description

@jgrund

Currently, there does not appear to be a way to determine whether a request was aborted or failed for another reason, as status is normalized to 0 in $http:

 /**
  * Resolves the raw $http promise.
  */
  function resolvePromise(response, status, headers) {
    // normalize internal statuses to 0
    status = Math.max(status, 0);

    (isSuccess(status) ? deferred.resolve : deferred.reject)({
      data: response,
      status: status,
      headers: headersGetter(headers),
      config: config
    });
  }

Internally a -1 is used to flag that the request either timed out or it was aborted via promise resolution.

What if we exposed the -1 as a valid status to give a better idea to rejection handlers why the request failed?

If this is the case I can create a PR to adress this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions