Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7151] MobileWeb: Complete Ti.Network.HTTPClient implementation

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2012-04-12T11:10:32.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsMobileWeb
Labelsmw-list
ReporterChris Barber
AssigneeChris Barber
Created2012-01-12T17:08:45.000+0000
Updated2017-03-24T20:52:11.000+0000

Description

Extends Evented. Properties: * file - TODO (setter should only work AFTER open() is called) * ondatastream - TODO * onerror - Done! * onload - Done! * onreadystatechange - Done! * onsendstream - TODO: NEEDS TESTING * timeout - Done! Constants: * connected - Done! * connectionType - Done! * location - Done! * readyState - Done! * responseData - TODO: returns a Ti.Blob * responseText - Done! * responseXML - Done! * status - Done! Update API docs including not "validatesSecureCertificate" is unsupported.

Attachments

FileDateSize
app.js2012-03-21T16:26:30.000+00001555

Comments

  1. Bryan Hughes 2012-03-21

    Pull Request: https://github.com/appcelerator/titanium_mobile/pull/1786
  2. Tim Poulsen 2012-04-12

    While the sample app.js code works, typical usage of the HTTP client does not. The following works on iOS and Android, but not on Mobile Web.
       var xhr = Titanium.Network.createHTTPClient();	
       xhr.open('GET', 'http://www.google.com');
       xhr.onload = function(e) {
           label1.text = xhr.responseData.toString();
       };
       xhr.ondatastream = function(e) {
           Ti.API.info("data " + e.progress);
       };
       xhr.onsendstream = function(e) {
           Ti.API.info("send " + e.progress);
       };
       xhr.send();
       
    The difference being your test app.js GETs a file (app.js) rather than pulling from an HTTP resource.
  3. Chris Barber 2012-04-12

    This is because google.com is a cross domain resource. This has been documented on the limitations page. The only way for the example above to work is if you define a Ti.Network.httpURLFormatter function to rewrite the URL to a proxy server that you would need to setup.
  4. Lee Morris 2017-03-24

    Closing ticket as fixed with reference to previous comments.

JSON Source