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

feat($http): add xhr statusText to completeRequest callback #6713

Closed
wants to merge 1 commit into from

Conversation

caitp
Copy link
Contributor

@caitp caitp commented Mar 17, 2014

Makes xhr status text accessible is $http success/error callback. See
www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-statustext

(This is just a rebased version of the other PR (#2665), meant to fix the bitrot so it can be merged.
Review is needed!)

Closes #2335
Closes #2665

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#6713)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@petebacondarwin
Copy link
Contributor

OK, looks good to me. But I think in 2.0 we should be passing around some kind of object rather than having to code up each parameter individually.

@caitp caitp added this to the 1.3.0-beta.3 milestone Mar 17, 2014
@caitp caitp added cla: yes and removed cla: no labels Mar 18, 2014
@btford btford modified the milestones: 1.3.0-beta.4, 1.3.0-beta.3 Mar 24, 2014
@IgorMinar IgorMinar self-assigned this Mar 24, 2014
@@ -148,12 +149,19 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
// while retrieving files from application cache.
if (status === 0) {
status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;

if (!statusText) {
statusText = status === 200 ? 'OK' : status === 404 ? 'Not Found' : 'Error';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should we do this? if there was no status text (which is rare) then we should not try to correct that IMO

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if we move this to the ngMock code?

@IgorMinar
Copy link
Contributor

the rest looks good

@IgorMinar
Copy link
Contributor

lgtm

@caitp
Copy link
Contributor Author

caitp commented Mar 27, 2014

Thanks Igor, I'll merge today

@caitp caitp closed this in 1d2414c Mar 27, 2014
caitp pushed a commit that referenced this pull request Mar 27, 2014
Makes xhr status text accessible is $http success/error callback.
See www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-statustext

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

Successfully merging this pull request may close these issues.

$http error callback doesn't have xhr.statusText
6 participants