From a86002f582de78e0cec6d77e1848eea504907ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 12 Feb 2014 20:05:41 -0800 Subject: [PATCH] add case insensitive test on ajax request type --- app/assets/javascripts/discourse/mixins/ajax.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/discourse/mixins/ajax.js b/app/assets/javascripts/discourse/mixins/ajax.js index 4fbc4b0bd69..4b27624dc46 100644 --- a/app/assets/javascripts/discourse/mixins/ajax.js +++ b/app/assets/javascripts/discourse/mixins/ajax.js @@ -72,14 +72,14 @@ Discourse.Ajax = Em.Mixin.create({ // We default to JSON on GET. If we don't, sometimes if the server doesn't return the proper header // it will not be parsed as an object. if (!args.type) args.type = 'GET'; - if ((!args.dataType) && (args.type === 'GET')) args.dataType = 'json'; + if (!args.dataType && args.type.toUpperCase() === 'GET') args.dataType = 'json'; $.ajax(Discourse.getURL(url), args); }; // For cached pages we strip out CSRF tokens, need to round trip to server prior to sending the // request (bypass for GET, not needed) - if(args.type && args.type !== 'GET' && !Discourse.Session.currentProp('csrfToken')){ + if(args.type && args.type.toUpperCase() !== 'GET' && !Discourse.Session.currentProp('csrfToken')){ return Ember.Deferred.promise(function(promise){ $.ajax(Discourse.getURL('/session/csrf')) .success(function(result){ @@ -93,8 +93,3 @@ Discourse.Ajax = Em.Mixin.create({ } }); - - - - -