[TIMOB-11260] Android: client.setTimeout does not work.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-10-29T20:28:37.000+0000 |
Affected Version/s | Release 2.1.2, Release 2.0.3 |
Fix Version/s | Release 3.1.0, 2012 Sprint 22 API, 2012 Sprint 22 |
Components | Android |
Labels | api, parity, qe-testadded |
Reporter | Amuktha Akkinepally |
Assignee | Hieu Pham |
Created | 2012-10-04T22:08:24.000+0000 |
Updated | 2014-06-19T12:43:09.000+0000 |
Description
the timeout can be set in the below ways:
client.timeout=timeOut;
client.setTimeout(timeOut);
var client = Titanium.Network.createHTTPClient({timeout=timeOut});
But it only works when its set as client.timeout=timeOut;
Steps to reproduce:
In the below code If you can replace with any of the above three it should work the same but it does not.
var win = Ti.UI.createWindow({
backgroundColor : 'pink'
});
win.open();
var postData = '{"email":"vaibhav.mundale@zeonsolutions.com","password_hash":"1234567","deviceUId":"14913af4-025c-e301-239b-1ba1-400e491f50a9","password":"1234567","store_id":"5"}';
var timeOut = 1500;
var client = Titanium.Network.createHTTPClient({timeout:timeOut});
if(Ti.Platform.osname !== 'android')
client.tlsVersion = Titanium.Network.TLS_VERSION_1_1;
client.open('POST', 'http://173.227.201.16/BradyMobile/Login');
client.setRequestHeader("Content-Type", "text/json");
client.onload = function()
{
alert('Status load:' + this.status +':'+ this.responseText);
}
client.onerror = function(e)
{
alert('Status error:' + this.status +':'+ this.responseText);
};
client.send(postData);
1. Run this code
Expected behavior: error alert pops up, timeout exception in log
Actual behavior: nothing happens
PR: https://github.com/appcelerator/titanium_mobile/pull/3342
Verified on: Studio: 3.0.1.201212181159 SDK: 3.1.0.v20130114171802 Android Device: LG P970 (v2.2), Samsung Galaxy Note (v2.3.6)