[Pkg-javascript-commits] [dojo] 04/09: Return undefined for JSON requests with HTTP Status 204, rather than throw, since it's successful by definition. (1.1 branch) Refs #6601

David Prévot taffit at moszumanska.debian.org
Mon May 11 20:11:55 UTC 2015


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

taffit pushed a commit to annotated tag 1.1.1
in repository dojo.

commit 1d68b7c8bf40f55781ed0f36ea31d2b797d98712
Author: Adam Peller <github at peller.org>
Date:   Tue Apr 29 21:18:06 2008 +0000

    Return undefined for JSON requests with HTTP Status 204, rather than throw, since it's successful by definition.  (1.1 branch) Refs #6601
    
    git-svn-id: http://svn.dojotoolkit.org/src/branches/1.1/dojo@13458 560b804f-0ae3-0310-86f3-f6aa0a117693
---
 _base/xhr.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/_base/xhr.js b/_base/xhr.js
index 1f18788..a109bec 100644
--- a/_base/xhr.js
+++ b/_base/xhr.js
@@ -209,7 +209,7 @@ dojo.require("dojo._base.query");
 					+ " to avoid potential security issues with JSON endpoints"
 					+ " (use djConfig.usePlainJson=true to turn off this message)");
 			}
-			return _d.fromJson(xhr.responseText);
+			return (xhr.status == 204) ? undefined : _d.fromJson(xhr.responseText);
 		},
 		"json-comment-filtered": function(xhr){ 
 			// NOTE: we provide the json-comment-filtered option as one solution to
@@ -222,7 +222,8 @@ dojo.require("dojo._base.query");
 			if(cStartIdx == -1 || cEndIdx == -1){
 				throw new Error("JSON was not comment filtered");
 			}
-			return _d.fromJson(value.substring(cStartIdx+2, cEndIdx));
+			return (xhr.status == 204) ? undefined :
+				_d.fromJson(value.substring(cStartIdx+2, cEndIdx));
 		},
 		"javascript": function(xhr){ 
 			// FIXME: try Moz and IE specific eval variants?

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



More information about the Pkg-javascript-commits mailing list