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

No way to get HTTP response Reason Phrase from $http #5492

Closed
gimmi opened this issue Dec 20, 2013 · 6 comments
Closed

No way to get HTTP response Reason Phrase from $http #5492

gimmi opened this issue Dec 20, 2013 · 6 comments

Comments

@gimmi
Copy link

gimmi commented Dec 20, 2013

As described in the subject, seems that there is no way to access HTTP reason phrase from $http results:

$http.get(/*...*/).then(function (ret) {
    // ret.status is available, but not ret.reasonPhrase
}, function (err) {
    // ret.status is available, but not ret.reasonPhrase
});

I know that the reasonPrase should only contain a human readable translation of the status code, but i have some service that uses it to return additional infos not found elsewhere. Can reason phrase be added to the returned object?

@IgorMinar
Copy link
Contributor

I believe that there was a PR for this but I can't find it now.

The PR changed a ton of stuff in http and we weren't happy about that.

If someone can create a PR with minimal changes to http/httpBackend then we'll accept it, otherwise I find it hard to justify big code changes for this obscure feature.

@gimmi
Copy link
Author

gimmi commented Dec 20, 2013

Hmm I'll take a look at it during weekend

@benbenwilde
Copy link

+1

@mjc-gh
Copy link

mjc-gh commented Jan 23, 2014

Shouldn't this be as easy as adding the (properly parsed) statusText to the completeRequest() call in $httpBackend. Then in $http we would need to just add the additional parameters to both done() and resolvePromise().

One a site note, should the signatures of these functions be made more consistent? Should it always be (status, statusText, response, headers)?

@lennybacon
Copy link

+1

PR: #2665

@linclark
Copy link
Contributor

Looks like #2665 was committed as #6713.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants