XHR
XHR copied to clipboard
How to get Header information from a request?
Amazing library;
i wonder how to get Header information?
xhr.POST(Alloy.CFG.api_url +'/authenticate', login_data, onSuccessCallback, onErrorCallback,opts);
function onSuccessCallback(e){
Ti.API.info('AUTH DATA:', e);
}
Only brings the body. What about the Headers?
Adding:
result.headers = xhr.getResponseHeaders();
https://github.com/raulriera/XHR/blob/master/xhr.js#L276
Solves it for uncached calls. But it needs to play nice with the cache writing process.
var result = {};
result.result = "cache";
result.status = 304;
result.headers = "cache";
// not modified
result.data = cache;
onSuccess(result);