Author: doll
Date: Wed Feb 20 19:06:33 2008
New Revision: 629680
URL: http://svn.apache.org/viewvc?rev=629680&view=rev
Log:
Fix for io.js : header params are no longer escaped which enables posts to
work. Also added hasOwnProperty to caja-proof the code.
Modified:
incubator/shindig/trunk/features/core.io/io.js
Modified: incubator/shindig/trunk/features/core.io/io.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/core.io/io.js?rev=629680&r1=629679&r2=629680&view=diff
==============================================================================
--- incubator/shindig/trunk/features/core.io/io.js (original)
+++ incubator/shindig/trunk/features/core.io/io.js Wed Feb 20 19:06:33 2008
@@ -184,7 +184,7 @@
var postData = {
url: url,
httpMethod : params.METHOD || "GET",
- headers: gadgets.io.encodeValues(headers),
+ headers: gadgets.io.encodeValues(headers, false),
postData : params.POST_DATA || "",
authz : auth || "",
st : st || ""
@@ -197,22 +197,26 @@
* (key=value&...)
*
* @param {Object} fields The post fields you wish to encode
+ * @param {Boolean} opt_noEscaping An optional parameter specifying whether
+ * to turn off escaping of the parameters. Defaults to false.
* @return {String} The processed post data in www-form-urlencoded format.
*
* @member gadgets.io
*/
- encodeValues : function (fields) {
+ encodeValues : function (fields, opt_noEscaping) {
+ var escape = !opt_noEscaping;
+
var buf = [];
var first = false;
- for (var i in fields) {
+ for (var i in fields) if (fields.hasOwnProperty(i)) {
if (!first) {
first = true;
} else {
buf.push("&");
}
- buf.push(encodeURIComponent(i));
+ buf.push(escape ? encodeURIComponent(i) : i);
buf.push("=");
- buf.push(encodeURIComponent(fields[i]));
+ buf.push(escape ? encodeURIComponent(fields[i]) : fields[i]);
}
return buf.join("");
},