This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix($resource): don't allow using promises as
timeout
and log a war…
…ning Promises never worked correctly as values for `timeout` in `$resource`, because the same value has to be re-used for multiple requests (and it is not possible to `angular.copy()` a promise). Now (in addition to ignoring a non-numeric `timeout`), a warning is logged to the console using `$log.debug()`. Partly fixes #13393. BREAKING CHANGE: Possible breaking change for users who updated their code to provide a `timeout` promise for a `$resource` request in version 1.4.8. Up to v1.4.7 (included), using a promise as a timeout in `$resource`, would silently fail (i.e. have no effect). In v1.4.8, using a promise as timeout would have the (buggy) behaviour described in #12657 (comment) (i.e. it will work as expected for the first time you resolve the promise and will cancel all subsequent requests after that - one has to re-create the resource class. This is feature was not documented.) With this change, using a promise as timeout in 1.4.9 onwsards is not allowed. It will log a warning and ignore the timeout value. If you need support for cancellable `$resource` actions, you should upgrade to version 1.5 or higher.
- Loading branch information