Author: johnh
Date: Thu Mar 12 01:35:39 2009
New Revision: 752742
URL: http://svn.apache.org/viewvc?rev=752742&view=rev
Log:
Legacy compatibility updates for _IG_FetchContent:
1. If obj.data is undefined or null, pass in "" to the callback.
2. Uppercase all inbound params since _IG_FetchContent honored them, eg.
"post_data" or "headers".
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/core/legacy.js
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/core/legacy.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/core/legacy.js?rev=752742&r1=752741&r2=752742&view=diff
==============================================================================
---
incubator/shindig/trunk/features/src/main/javascript/features/core/legacy.js
(original)
+++
incubator/shindig/trunk/features/src/main/javascript/features/core/legacy.js
Thu Mar 12 01:35:39 2009
@@ -40,18 +40,26 @@
})();
function _IG_Fetch_wrapper(callback, obj) {
- callback(obj.data);
+ callback(obj.data ? obj.data : "");
}
function _IG_FetchContent(url, callback, opt_params) {
var params = opt_params || {};
- // this is really the only legacy parameter documented
+ // This is really the only legacy parameter documented
// at http://code.google.com/apis/gadgets/docs/remote-content.html#Params
if (params.refreshInterval) {
params['REFRESH_INTERVAL'] = params.refreshInterval;
} else {
params['REFRESH_INTERVAL'] = 3600;
}
+ // Other params, such as POST_DATA, were supported in lower case.
+ // Upper-case all param keys as a convenience, since all valid values
+ // are uppercased.
+ for (var param in params) {
+ var pvalue = params[param];
+ delete params[param];
+ params[param.toUpperCase()] = pvalue;
+ }
var cb = gadgets.util.makeClosure(null, _IG_Fetch_wrapper, callback);
gadgets.io.makeRequest(url, cb, params);
}