Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19030

Android: HttpClient setOnload() and setOnerror() methods do not work

    Details

    • Story Points:
      5
    • Sprint:
      2015 Sprint 13 SDK

      Description

      Reproduce Step:

      1.Simple run the following code in a classic mobile project.

      app.js

      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 log

      [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'
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                sliang Shuo Liang
                Reviewer:
                Ashraf Abu (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-19993
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code