diff options
| -rw-r--r-- | docs/content/cookbook/buzz.ngdoc | 4 | ||||
| -rw-r--r-- | src/service/browser.js | 2 | ||||
| -rw-r--r-- | src/service/resource.js | 4 | ||||
| -rw-r--r-- | src/service/xhr.js | 8 | ||||
| -rw-r--r-- | test/service/browserSpecs.js | 10 |
5 files changed, 14 insertions, 14 deletions
diff --git a/docs/content/cookbook/buzz.ngdoc b/docs/content/cookbook/buzz.ngdoc index c4e5ae37..ca6a22b4 100644 --- a/docs/content/cookbook/buzz.ngdoc +++ b/docs/content/cookbook/buzz.ngdoc @@ -18,8 +18,8 @@ to retrieve Buzz activity and comments. this.Activity = $resource( 'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments', {alt: 'json', callback: 'JSON_CALLBACK'}, - { get: {method: 'JSON', params: {visibility: '@self'}}, - replies: {method: 'JSON', params: {visibility: '@self', comments: '@comments'}} + { get: {method: 'JSONP', params: {visibility: '@self'}}, + replies: {method: 'JSONP', params: {visibility: '@self', comments: '@comments'}} }); } BuzzController.prototype = { diff --git a/src/service/browser.js b/src/service/browser.js index da82b9b0..65a63f62 100644 --- a/src/service/browser.js +++ b/src/service/browser.js @@ -99,7 +99,7 @@ function Browser(window, document, body, XHR, $log, $sniffer) { */ self.xhr = function(method, url, post, callback, headers) { outstandingRequestCount ++; - if (lowercase(method) == 'json') { + if (lowercase(method) == 'jsonp') { var callbackId = ("angular_" + Math.random() + '_' + (idCounter++)).replace(/\d\./, ''); window[callbackId] = function(data) { window[callbackId].data = data; diff --git a/src/service/resource.js b/src/service/resource.js index 969e4be1..2082b9ed 100644 --- a/src/service/resource.js +++ b/src/service/resource.js @@ -40,7 +40,7 @@ * - `action` – {string} – The name of action. This name becomes the name of the method on your * resource object. * - `method` – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`, `DELETE`, - * and `JSON` (also known as JSONP). + * and `JSONP` * - `params` – {object=} – Optional set of pre-bound parameters for this action. * - isArray – {boolean=} – If true then the returned object for this action is an array, see * `returns` section. @@ -163,7 +163,7 @@ this.Activity = $resource( 'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments', {alt:'json', callback:'JSON_CALLBACK'}, - {get:{method:'JSON', params:{visibility:'@self'}}, replies: {method:'JSON', params:{visibility:'@self', comments:'@comments'}}} + {get:{method:'JSONP', params:{visibility:'@self'}}, replies: {method:'JSONP', params:{visibility:'@self', comments:'@comments'}}} ); } diff --git a/src/service/xhr.js b/src/service/xhr.js index d9c78fd6..7970622b 100644 --- a/src/service/xhr.js +++ b/src/service/xhr.js @@ -85,7 +85,7 @@ * {@link http://en.wikipedia.org/wiki/Rainbow_table salt for added security}. * * @param {string} method HTTP method to use. Valid values are: `GET`, `POST`, `PUT`, `DELETE`, and - * `JSON`. `JSON` is a special case which causes a + * `JSONP`. `JSONP` is a special case which causes a * [JSONP](http://en.wikipedia.org/wiki/JSON#JSONP) cross domain request using script tag * insertion. * @param {string} url Relative or absolute URL specifying the destination of the request. For @@ -135,13 +135,13 @@ <div ng:controller="FetchCntl"> <select ng:model="method"> <option>GET</option> - <option>JSON</option> + <option>JSONP</option> </select> <input type="text" ng:model="url" size="80"/> <button ng:click="fetch()">fetch</button><br> <button ng:click="updateModel('GET', 'index.html')">Sample GET</button> - <button ng:click="updateModel('JSON', 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">Sample JSONP</button> - <button ng:click="updateModel('JSON', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">Invalid JSONP</button> + <button ng:click="updateModel('JSONP', 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">Sample JSONP</button> + <button ng:click="updateModel('JSONP', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">Invalid JSONP</button> <pre>code={{code}}</pre> <pre>response={{response}}</pre> </div> diff --git a/test/service/browserSpecs.js b/test/service/browserSpecs.js index 7e50a280..41f17f2a 100644 --- a/test/service/browserSpecs.js +++ b/test/service/browserSpecs.js @@ -111,7 +111,7 @@ describe('browser', function() { }); describe('xhr', function() { - describe('JSON', function() { + describe('JSONP', function() { var log; function callback(code, data) { @@ -129,7 +129,7 @@ describe('browser', function() { it('should add script tag for JSONP request', function() { var notify = jasmine.createSpy('notify'); - browser.xhr('JSON', 'http://example.org/path?cb=JSON_CALLBACK', null, callback); + browser.xhr('JSONP', 'http://example.org/path?cb=JSON_CALLBACK', null, callback); browser.notifyWhenNoOutstandingRequests(notify); expect(notify).not.toHaveBeenCalled(); expect(scripts.length).toEqual(1); @@ -148,7 +148,7 @@ describe('browser', function() { it('should call callback when script fails to load', function() { - browser.xhr('JSON', 'http://example.org/path?cb=JSON_CALLBACK', null, callback); + browser.xhr('JSONP', 'http://example.org/path?cb=JSON_CALLBACK', null, callback); var script = scripts[0]; expect(typeof script.onload).toBe('function'); expect(typeof script.onerror).toBe('function'); @@ -160,7 +160,7 @@ describe('browser', function() { it('should update the outstandingRequests counter for successful requests', function() { var notify = jasmine.createSpy('notify'); - browser.xhr('JSON', 'http://example.org/path?cb=JSON_CALLBACK', null, callback); + browser.xhr('JSONP', 'http://example.org/path?cb=JSON_CALLBACK', null, callback); browser.notifyWhenNoOutstandingRequests(notify); expect(notify).not.toHaveBeenCalled(); @@ -175,7 +175,7 @@ describe('browser', function() { it('should update the outstandingRequests counter for failed requests', function() { var notify = jasmine.createSpy('notify'); - browser.xhr('JSON', 'http://example.org/path?cb=JSON_CALLBACK', null, callback); + browser.xhr('JSONP', 'http://example.org/path?cb=JSON_CALLBACK', null, callback); browser.notifyWhenNoOutstandingRequests(notify); expect(notify).not.toHaveBeenCalled(); |
