From 59adadca086853c5de6867ae853f6f27a3af4bbe Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Fri, 5 Aug 2011 01:24:41 +0200 Subject: feat($http): new $http service, removing $xhr.* Features: - aborting requests - more flexible callbacks (per status code) - custom request headers (per request) - access to response headers - custom transform functions (both request, response) - caching - shortcut methods (get, head, post, put, delete, patch, jsonp) - exposing pendingCount() - setting timeout Breaks Renaming $xhr to $http Breaks Takes one parameter now - configuration object Breaks $xhr.cache removed - use configuration cache: true instead Breaks $xhr.error, $xhr.bulk removed Breaks Callback functions get parameters: response, status, headers Closes #38 Closes #80 Closes #180 Closes #299 Closes #342 Closes #395 Closes #413 Closes #414 Closes #507 --- test/service/xhr.errorSpec.js | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 test/service/xhr.errorSpec.js (limited to 'test/service/xhr.errorSpec.js') diff --git a/test/service/xhr.errorSpec.js b/test/service/xhr.errorSpec.js deleted file mode 100644 index f9ce2b72..00000000 --- a/test/service/xhr.errorSpec.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -describe('$xhr.error', function() { - var log; - - beforeEach(inject(function($provide) { - $provide.value('$xhr.error', jasmine.createSpy('$xhr.error')); - $provide.factory('$xhrError', ['$xhr.error', identity]); - log = ''; - })); - - - function callback(code, response) { - expect(code).toEqual(200); - log = log + toJson(response) + ';'; - } - - - it('should handle non 200 status codes by forwarding to error handler', inject(function($browser, $xhr, $xhrError) { - $browser.xhr.expectPOST('/req', 'MyData').respond(500, 'MyError'); - $xhr('POST', '/req', 'MyData', callback); - $browser.xhr.flush(); - var cb = $xhrError.mostRecentCall.args[0].success; - expect(typeof cb).toEqual('function'); - expect($xhrError).toHaveBeenCalledWith( - {url: '/req', method: 'POST', data: 'MyData', success: cb}, - {status: 500, body: 'MyError'}); - })); -}); -- cgit v1.2.3