[TIMOB-17047] iOS: HTTPClient callbacks are not triggered for synchronous request
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2014-05-30T22:09:06.000+0000 |
Affected Version/s | Release 3.3.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | qe-3.3.0, regression |
Reporter | Kajenthiran Velummaylum |
Assignee | Pedro Enrique |
Created | 2014-05-30T05:52:40.000+0000 |
Updated | 2017-03-22T20:32:54.000+0000 |
Description
HTTPClient callbacks are not triggered when HTTPClient synchronous requests. Following callbacks are tested and not triggered in SDK 3.3.0.v20140528144113.
Callbacks
1. onload
2. onerror
3. onreadystatechange
4. onsendstream
It's a *regression* since it doesn't happen in 3.2.3 GA.
*Steps to reproduce:*
1. Run the application with the code below.
2. Check the alert dialogs from the callbacks.
*Actual Result:* Alert box are not showing for any callbacks for the synchronous requests. It works for asynchronous requests.
*Expected Result:* callbacks should work for both synchronous and asynchronous requests.
var win = Titanium.UI.createWindow({title:'Charset Test window', backgroundColor : 'white'});
var button = Titanium.UI.createButton({title:'OnError Check'});
button.addEventListener('click', function()
{
var valid_url = 'http://www.google.com';
var invalid_url = 'http://www.somethingxx.com';
var xhr = Ti.Network.createHTTPClient();
xhr.onload = function() {
alert('onload');
};
xhr.onerror = function() {
alert('onerror');
};
xhr.onreadystatechange = function() {
alert('statechanged');
};
xhr.onsendstream = function() {
alert('sendstream');
};
xhr.open('GET',valid_url,false);
// Uncomment this to check the onerror callback
//xhr.open('GET',invalid_url,false);
xhr.send();
});
win.add(button);
win.open();
cc [~mlangston]
This is a synchronous requests and works as intended. You can get the response properties after making the call. The limitation to this, an Apple NSURLRequest limitation, is that we can't get the progress of the request (onsendstream and ondatastream)
prints *undefined* for both synchronous and asynchronous type of requests. But if you place some statements inside the callback like this
It's not executed for synchronous type requests with the test environment mentioned in description section.
I'm comfortable with marking this as "Won't Fix". [~bhatfield], can we please make sure this is WELL documented?
Closing ticket as the issue will not fix and with reference to the above comments.