Reproduce Step:
1.Simple run the following code in a classic mobile project.
var url = "http://www.appcelerator.com";
var client = Ti.Network.createHTTPClient({
timeout : 5000 // in milliseconds
});
client.setOnload(function(e) {
Ti.API.info("Received text: " + this.responseText);
alert('success');
});
client.setOnerror(function(e) {
Ti.API.debug(e.error);
alert('error');
});
// Prepare the connection.
client.open("GET", url);
// Send the request.
client.send();
Expect Result:
Should fire alert event. Like its behaviour in iOS
Acutal Result:
Return a error, like this:
[ERROR] : TiExceptionHandler: (main) [100,100] ----- Titanium Javascript Runtime Error -----
[ERROR] : TiExceptionHandler: (main) [0,100] - In app.js:413,9
[ERROR] : TiExceptionHandler: (main) [0,100] - Message: Uncaught TypeError: Object #<HTTPClient> has no method 'setOnload'
[ERROR] : TiExceptionHandler: (main) [1,101] - Source: client.setOnload(function(e) {
[ERROR] : V8Exception: Exception occurred at app.js:413: Uncaught TypeError: Object #<HTTPClient> has no method 'setOnload'
master PR: https://github.com/appcelerator/titanium_mobile/pull/6930
Verified the fix. The setOnload() and setOnerror() methods work as expected. Closing. Environment: Appc Studio : 4.2.0.201508062204 Ti SDK : 5.0.0.v20150821030422 Ti CLI : 4.1.5 Alloy : 1.7.5 MAC Yosemite : 10.10.4 Appc NPM : 4.2.0-1 Appc CLI : 5.0.0-12 Node: v0.10.37 Nexus 5 - Android 5.1.1 Node : v0.10.37