[Pkg-javascript-commits] [backbone] 02/21: processData should use ajax default (true), and only be set to false when doing a non-GET request

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:01:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.5.2
in repository backbone.

commit 7816861673119d2b30a2f9ae9b9bd34f13a96c9f
Author: Aidan Feldman <aidan.feldman at gmail.com>
Date:   Thu Jul 7 23:13:50 2011 -0700

    processData should use ajax default (true), and only be set to false when doing a non-GET request
---
 backbone.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/backbone.js b/backbone.js
index 5455ebc..d767fc9 100644
--- a/backbone.js
+++ b/backbone.js
@@ -1035,8 +1035,7 @@
     // Default JSON-request options.
     var params = _.extend({
       type:         type,
-      dataType:     'json',
-      processData:  false
+      dataType:     'json'
     }, options);
 
     // Ensure that we have a URL.
@@ -1053,7 +1052,6 @@
     // For older servers, emulate JSON by encoding the request into an HTML-form.
     if (Backbone.emulateJSON) {
       params.contentType = 'application/x-www-form-urlencoded';
-      params.processData = true;
       params.data        = params.data ? {model : params.data} : {};
     }
 
@@ -1069,6 +1067,11 @@
       }
     }
 
+    // Don't process data on a non-GET request.
+    if (params.type !== 'GET') {
+      params.processData = false;
+    }
+
     // Make the request.
     return $.ajax(params);
   };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list