prototype: Make the Ajax.Response#headerJSON property correctly decode unicode characters. Closes #9285
This commit is contained in:
parent
827c8c6b48
commit
44c9d8937a
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Make the Ajax.Response#headerJSON property correctly decode unicode characters. Closes #9285. [Marius Feraru, Tobie Langel]
|
||||
|
||||
* Make sure Event and Event.extend are defined before wrapping events and calling their handler. Prevents a known Firefox bug from throwing errors on page load/unload (cf.: https://bugzilla.mozilla.org/show_bug.cgi?id=361271). Closes #5393, #9421. [staaky, John Resig, sam, Tobie Langel]
|
||||
|
||||
* Minor cosmetic changes to the display of unit tests in terminal. [Tobie Langel]
|
||||
|
|
|
@ -276,8 +276,10 @@ Ajax.Response = Class.create({
|
|||
|
||||
_getHeaderJSON: function() {
|
||||
var json = this.getHeader('X-JSON');
|
||||
if (!json) return null;
|
||||
json = decodeURIComponent(escape(json));
|
||||
try {
|
||||
return json ? json.evalJSON(this.request.options.sanitizeJSON) : null;
|
||||
return json.evalJSON(this.request.options.sanitizeJSON);
|
||||
} catch (e) {
|
||||
this.request.dispatchException(e);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
},
|
||||
|
||||
headerJson: {
|
||||
'X-JSON': '{"test": 123}'
|
||||
'X-JSON': '{"test": "hello #éà"}'
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -347,8 +347,8 @@
|
|||
new Ajax.Request("/response", extendDefault({
|
||||
parameters: Fixtures.headerJson,
|
||||
onComplete: function(transport, json) {
|
||||
assertEqual(123, transport.headerJSON.test);
|
||||
assertEqual(123, json.test);
|
||||
assertEqual('hello #éà', transport.headerJSON.test);
|
||||
assertEqual('hello #éà', json.test);
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
Loading…
Reference in New Issue