PDA

View Full Version : Get response headers from inside model.save()'s failure callback.



dajester2008
14 Jan 2014, 1:02 PM
I need access to the response object in the event of an error in the response while saving a model.

I've been digging in the source code, but I cannot find any way to get the response object in order to get the response headers:


Ext.define("MyModel",{
extend : "Ext.data.Model"
...
});

m = new MyModel();

// this is a workaround, but it is a bit clunky...
m.getProxy().on("exception",function(proxy,response) {
// have access through response.getAllResponseHeaders()
},this,{single:true});

m.save({
failure : function(model,operation) {
// (how) can I get the response headers here?? if not currently possible, then this is a feature request.
// if I were using Ext.Ajax.request(), I have access to the response object. no so here...
}
})

dajester2008
14 Jan 2014, 1:04 PM
my mistake, meant to post this to Q&A. not sure how to move it...