prototype: Ensure that an Ajax.Request's parameters option can be a Hash. Closes #10172.
This commit is contained in:
parent
c85285496b
commit
769ae42fcc
|
@ -1,3 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Ensure that an Ajax.Request's parameters option can be a Hash. Closes #10172. [kangax, sam]
|
||||
|
||||
* Ensure no comment nodes are returned in Selector queries (IE improperly returns comment nodes on getElementsByTagName("*")). Change Element#descendants to use Element#getElementsBySelector in order to avoid this issue. Closes #10220. [Jeff Gobel, Andrew Dupont]
|
||||
|
||||
* Re-enable the XPath approach in Selector for Safari 3. Falls back to the non-XPath version when it sees a problematic token. [Andrew Dupont]
|
||||
|
|
|
@ -58,8 +58,11 @@ Ajax.Base = Class.create({
|
|||
Object.extend(this.options, options || { });
|
||||
|
||||
this.options.method = this.options.method.toLowerCase();
|
||||
|
||||
if (Object.isString(this.options.parameters))
|
||||
this.options.parameters = this.options.parameters.toQueryParams();
|
||||
else if (Object.isHash(this.options.parameters))
|
||||
this.options.parameters = this.options.parameters.toObject();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -389,7 +389,22 @@
|
|||
parameters: { 'X-TEST': 'some value' },
|
||||
onComplete: function(transport) {
|
||||
assertEqual('some value', transport.getHeader('X-Test'));
|
||||
assertNull(null, transport.getHeader('X-Inexistant'));
|
||||
assertNull(transport.getHeader('X-Inexistant'));
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
info(message);
|
||||
}
|
||||
}},
|
||||
|
||||
testParametersCanBeHash: function() {with(this) {
|
||||
if (isRunningFromRake) {
|
||||
new Ajax.Request("/response", extendDefault({
|
||||
parameters: $H({ "one": "two", "three": "four" }),
|
||||
onComplete: function(transport) {
|
||||
assertEqual("two", transport.getHeader("one"));
|
||||
assertEqual("four", transport.getHeader("three"));
|
||||
assertNull(transport.getHeader("toObject"));
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue