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

feat(http): Add 'useLegacyMethods' to $httpProvider #12112

Closed
wants to merge 1 commit into from

Conversation

realityking
Copy link
Contributor

For now it defaults to true. This will open up a path to remove the short hand methods in the long run.

@petebacondarwin
Copy link
Member

I like the idea behind this. success() and error() have always worried me...

@petebacondarwin
Copy link
Member

A few things

  • The documentation for it needs to be beefed up
  • a deprecation notice needs to go in the commit message
  • if the legacy methods have been turned off then they should be changed to throw a helpful error rather than simply missing.

@realityking
Copy link
Contributor Author

  • I'll get to the documentation. Just wanted to get some feedback first ;)
  • Is there a special format for deprecation notices?

@petebacondarwin
Copy link
Member

Perhaps something like this would work: 38fbe3e

@petebacondarwin
Copy link
Member

This would close #10508

@realityking realityking force-pushed the httpLegacy branch 3 times, most recently from aecb954 to 3ead869 Compare July 14, 2015 22:03
@realityking
Copy link
Contributor Author

Sorry, it took me way too long to get back to this.

I've changed the documentation to to mainly cover then and added a deprecation notice to both the commit and the documentation. I've also added the error messaged.

Small aside: Once this is merged, it would be great if this could be uplifted to 1.4, as this would allow switching the default to off in 1.5.

}
else {
promise.success = function() {
throw namespaceMinErr('nosuccess', 'The method `success` on the $http result has been disabled.');
Copy link
Member

Choose a reason for hiding this comment

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

These should be $httpMinErr not namespaceMinErr.
Also we must create error docs for these errors in https://github.com/angular/angular.js/tree/master/docs/content/error/%24http

@petebacondarwin
Copy link
Member

@realityking - thanks for improving this. Just a couple of issues with the minerr stuff and then we are good to go.

@petebacondarwin
Copy link
Member

If we default to false then this is a breaking change and needs to go into 1.5

@realityking
Copy link
Contributor Author

I've fixed minErr and added the tests. Is there a script to generate the scaffolding for the error docs or is that all by hand?

As for 1.5, my I idea was to ship this with default true in 1.4.x and change the default to false in 1.5. That would allow people to fix their libraries and apps ahead of the release. Also, we'd get rid of the legacy methods being front and center in the docs.

@petebacondarwin
Copy link
Member

That is better.

For the error doc, you just make a copy of a file like https://github.com/angular/angular.js/blob/master/docs/content/error/%24http/badreq.ngdoc and doctor it to your needs. The rest is magic.

One last comment about the provider method, I feel that useLegacyMethods is a bit vague. Perhaps useLegacyPromiseExtensions or something?

@realityking realityking changed the title feat(http): Add 'useLegacyHttpMethods' to $httpProvider feat(http): Add 'useLegacyMethods' to $httpProvider Jul 22, 2015
For now it defaults to true. This will open up a path to remove them.

DEPRECATION NOTICE:

The methods 'success' and 'error' on promises returned by $http are now deprecated.
@realityking
Copy link
Contributor Author

I think I've addressed everything.

@petebacondarwin petebacondarwin self-assigned this Jul 23, 2015
@petebacondarwin
Copy link
Member

I will land this week.

petebacondarwin pushed a commit to petebacondarwin/angular.js that referenced this pull request Aug 1, 2015
The legacy methods, `success` and `error`, have been deprecated.

Set this to `false` to cause `$http` to throw an error if these methods are
used in the application.

For now it defaults to `true`. In a future release we will remove these
methods altogether.

DEPRECATION NOTICE:

The legacy methods 'success' and 'error' on promises returned by $http
are now deprecated.

Closes angular#12112
petebacondarwin pushed a commit to petebacondarwin/angular.js that referenced this pull request Aug 1, 2015
The legacy methods, `success` and `error`, have been deprecated.

Set this to `false` to cause `$http` to throw an error if these methods are
used in the application.

For now it defaults to `true`. In a future release we will remove these
methods altogether.

DEPRECATION NOTICE:

The legacy methods 'success' and 'error' on promises returned by $http
are now deprecated.

Closes angular#12112
@realityking realityking deleted the httpLegacy branch August 2, 2015 18:58
netman92 pushed a commit to netman92/angular.js that referenced this pull request Aug 8, 2015
The legacy methods, `success` and `error`, have been deprecated.

Set this to `false` to cause `$http` to throw an error if these methods are
used in the application.

For now it defaults to `true`. In a future release we will remove these
methods altogether.

DEPRECATION NOTICE:

The legacy methods 'success' and 'error' on promises returned by $http
are now deprecated.

Closes angular#12112
Closes angular#10508
ggershoni pushed a commit to ggershoni/angular.js that referenced this pull request Sep 29, 2015
The legacy methods, `success` and `error`, have been deprecated.

Set this to `false` to cause `$http` to throw an error if these methods are
used in the application.

For now it defaults to `true`. In a future release we will remove these
methods altogether.

DEPRECATION NOTICE:

The legacy methods 'success' and 'error' on promises returned by $http
are now deprecated.

Closes angular#12112
Closes angular#10508
wking added a commit to azurestandard/azure-angular-providers that referenced this pull request Apr 28, 2016
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.

None yet

3 participants