From 45f47ff6cd264dcd347e6df92c9ef39b0ae8aaba Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Wed, 10 Aug 2011 15:59:55 +0200 Subject: fix($browser.xhr): change method "JSON" to "JSONP" Breaks "JSON" xhr method is now called "JSONP" --- src/service/browser.js | 2 +- src/service/resource.js | 4 ++-- src/service/xhr.js | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') 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 @@
code={{code}}
response={{response}}