Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-160] iPhone - status and statusText not working on HTTPClient object

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:52:11.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsios, response, xhr
ReporterKevin Whinnery
AssigneeReggie Seagraves
Created2011-04-15T02:24:30.000+0000
Updated2011-05-15T22:18:51.000+0000

Description

When handling a response in HTTPClient's onreadystatechange handler function, the client object's status and statusText properties do not appear to be populated. Change the following lines in the XHR test in the Kitchen Sink to reproduce quickly:

    var c = Titanium.Network.createHTTPClient();

// set on ready state change function
c.onreadystatechange = function()
{
    Titanium.API.debug('>>>>>>>>>>>>>>>>>>>>>>>> readyState = ' + this.readyState);
    Titanium.API.debug('>>>>>>>>>>>>>>>>>>>>>>>> status = ' + this.status);
    Titanium.API.debug('>>>>>>>>>>>>>>>>>>>>>>>> statusText = ' + this.statusText);
    if (this.readyState == 4)
    {

        document.getElementById('html').innerHTML = this.responseText;
    }
};
// open the client
c.open('GET','http://www.google.com');

// send the data
c.send();

Comments

  1. Jeff Haynie 2011-04-15

    yeah, we need to make sure to fully implement the XHR spec.

  2. Ygor Lemos 2011-04-15

    Even now on 1.4.2 XHR spec doesn't appear to be fully implemented yet.

    status never gets 404, 303 and other HTTP status codes other than 200.

    also statusText never gets populated.

  3. Stephen Tramer 2011-04-15

    All properties which we still support (do not support statusText; separate bug dealing with XHR compliance, already filed) work properly.

    Tested against 1.6.0 RC1

  4. Nikolai Derzhak 2011-04-15

    rollback wrong update
  5. Andrey 2011-05-15

    Tested on 1.6.2 -- 200 & 406 work, 401 gets absolutely no response, not even a status with the code number.

JSON Source