Skip to content

Instantly share code, notes, and snippets.

@shanesmith
Created May 3, 2012 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanesmith/2590198 to your computer and use it in GitHub Desktop.
Save shanesmith/2590198 to your computer and use it in GitHub Desktop.
Extended proxy to resolve Android 3+ url param bug
/**
* Android 3+ doesn't like url params
* for file:// ajax request, so let's remove them!
*/
Ext.define('MyApp.proxy.NoParamAjax', {
extend: 'Ext.data.proxy.Ajax',
alias: 'proxy.noparamajax',
/**
* Set config to remove auto params
*/
config: {
noCache: false,
enablePagingParams: false,
},
/**
* Copied from Ext.data.proxy.Ajax, modified to remove params
*/
doRequest: function(operation, callback, scope) {
var writer = this.getWriter(),
request = this.buildRequest(operation);
request.setConfig({
headers : this.getHeaders(),
timeout : this.getTimeout(),
method : this.getMethod(request),
callback : this.createRequestCallback(request, operation, callback, scope),
scope : this
});
if (operation.getWithCredentials() || this.getWithCredentials()) {
request.setWithCredentials(true);
}
request = writer.write(request);
var requestCfg = request.getCurrentConfig();
// remove all url params for Android 3+ compatibility
requestCfg.params = {};
Ext.Ajax.request(requestCfg);
return request;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment