aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2012-01-06 19:17:31 -0800
committerVojta Jina2012-01-09 13:17:48 -0800
commitb8960c3710f20a3c56ecc27f382b2500f6dc1e05 (patch)
tree0352302c7e570e95699895eb4c27f046f4f313fb
parent67338ce06140f60fe08bf59f7eb6c9814743e907 (diff)
downloadangular.js-b8960c3710f20a3c56ecc27f382b2500f6dc1e05.tar.bz2
chore($http): small $http fixes
-rw-r--r--src/angular-mocks.js5
-rw-r--r--src/service/http.js13
-rw-r--r--src/service/httpBackend.js3
3 files changed, 11 insertions, 10 deletions
diff --git a/src/angular-mocks.js b/src/angular-mocks.js
index db4175d1..4b462a87 100644
--- a/src/angular-mocks.js
+++ b/src/angular-mocks.js
@@ -115,7 +115,7 @@ angular.module.ngMock.$Browser = function() {
* @description
* Flushes all pending requests and executes the defer callbacks.
*
- * @param {number=} number of miliseconds to flush. See {@link #defer.now}
+ * @param {number=} number of milliseconds to flush. See {@link #defer.now}
*/
self.defer.flush = function(delay) {
if (angular.isDefined(delay)) {
@@ -629,7 +629,8 @@ angular.module.ngMock.$httpBackendDecorator = function($delegate, $defer) {
if (!expectation.matchHeaders(headers))
throw Error('Expected ' + expectation + ' with different headers\n' +
- 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: ' + prettyPrint(headers));
+ 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: ' +
+ prettyPrint(headers));
expectations.shift();
diff --git a/src/service/http.js b/src/service/http.js
index aee079b8..fec4fc8d 100644
--- a/src/service/http.js
+++ b/src/service/http.js
@@ -118,8 +118,8 @@ function $HttpProvider() {
var providerResponseInterceptors = this.responseInterceptors = [];
- this.$get = ['$httpBackend', '$browser', '$exceptionHandler', '$cacheFactory', '$rootScope', '$q', '$injector',
- function($httpBackend, $browser, $exceptionHandler, $cacheFactory, $rootScope, $q, $injector) {
+ this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector',
+ function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) {
var defaultCache = $cacheFactory('$http'),
responseInterceptors = [];
@@ -134,8 +134,10 @@ function $HttpProvider() {
* @name angular.module.ng.$http
* @requires $httpBacked
* @requires $browser
- * @requires $exceptionHandler //TODO(i): still needed?
* @requires $cacheFactory
+ * @requires $rootScope
+ * @requires $q
+ * @requires $injector
*
* @param {object} config Object describing the request to be made and how it should be processed.
* The object has following properties:
@@ -369,10 +371,7 @@ function $HttpProvider() {
cachedResp = cache.get(config.url);
if (cachedResp) {
if (cachedResp.then) {
- // cached request has already been sent, but there is no response yet,
- // we need to register callback and fire callbacks when the request is back
- // note, we have to get the values from cache and perform transformations on them,
- // as the configurations don't have to be same
+ // cached request has already been sent, but there is no response yet
cachedResp.then(removePendingReq, removePendingReq);
return cachedResp;
} else {
diff --git a/src/service/httpBackend.js b/src/service/httpBackend.js
index c3114814..6da32600 100644
--- a/src/service/httpBackend.js
+++ b/src/service/httpBackend.js
@@ -57,7 +57,8 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, body, locati
var status;
// In IE6 and 7, this might be called synchronously when xhr.send below is called and the
- // response is in the cache
+ // response is in the cache. the promise api will ensure that to the app code the api is
+ // always async
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
completeRequest(