Description
When doing a HTTP GET on an incorrect URL the HTTPClient will throw onLoad rather than onError.
var win = Ti.UI.createWindow({backgroundColor: 'white'});
var lbl = Ti.UI.createLabel({
text: 'Tap me!',
color: 'black'
})
var url = 'http://httpbin.org/gert';
lbl.addEventListener('click', function(){
var client = Ti.Network.createHTTPClient({
onload : function(e) {
alert('onload');
},
onerror : function(e) {
alert('onerror');
}
});
client.open('GET', url);
client.send();
});
win.add(lbl);
win.open();
Steps To Reproduce
1. Add the above code to an app.js
2. Build to a device or emulator
3. Tap the label
Actual Result
An alert will be shown with onload
Expected Result
An alert should be shown with onerror
[~eharris] What is the typical behavior on other platforms? Does it fire onerror for any 400+ or 500+ status codes, and onload for 200/300+ codes?
Verified the fix. We get onerror now . Closing. Environment: Appc Studio: 4.1.0.201506261427 Ti SDK: 4.1.0.v20150630084319 Ti CLI: 4.0.1 Alloy: 1.6.2 Windows: 8.1 Enterprise 64-bit APPC NPM: 4.1.0-1 APPC CLI: 4.1.0-4 Device: Nokia Lumia 928 - Windows Phone 8.1 Windows emulator : 8.1