Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14734] Blackberry: Not getting this.responseText from Ti.Network.createHTTPClient

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-08-01T20:21:22.000+0000
Affected Version/sRelease 3.1.2
Fix Version/s2013 Sprint 16, 2013 Sprint 16 API, Release 3.2.0
ComponentsBlackBerry
Labelsqe-3.1.2, qe-testadded
ReporterPriya Agarwal
AssigneePedro Enrique
Created2013-08-01T09:33:55.000+0000
Updated2014-06-19T12:42:46.000+0000

Description

Not getting this.responseText from Ti.Network.createHTTPClient. Steps to reproduce: 1)Copy paste the code in app.js of default titanium project and run the app. 2)Click on the button 'create http client'. Expected result: 1. Should see a window with label 'HTTP client test' & a button with text 'Create HTTP Client'. 2. Should see an alert with message ' Success. See console for output'. You should see the HTML code for www.appcelerator.com. which is returned from this.responseText. Actual Result: 1. A window with label 'HTTP client test' & a button with text 'Create HTTP Client'. 2. an alert with message ' Success. See console for output'. is seen. In console do not get output of this.responseText.
var win = Ti.UI.createWindow({
	backgroundColor:'white'
});

var lbl = Ti.UI.createLabel({
	text:'HTTP client test',
	font:{fontSize:20},
	top:20,
	color:'brown'
});

var button = Ti.UI.createButton({
	title:'Create HTTP client',
	height:Ti.UI.SIZE,
	width:Ti.UI.SIZE
});


button.addEventListener('click',function(e){
	var url = "http://www.appcelerator.com";
 var client = Ti.Network.createHTTPClient({
     // function called when the response data is available
     onload : function(e) {
     	  Ti.API.info("Received text: " + this.responseText);
         alert('Success. See console for output');
     },
     // function called when an error occurs, including a timeout
     onerror : function(e) {
         Ti.API.debug(e.error);
         alert('Failed to get data');
     },
     timeout : 5000  // in milliseconds
 });
 // Prepare the connection.
 client.open("GET", url);
 // Send the request.
 client.send();
});

 
win.add(lbl);
win.add(button);
win.open();

Comments

  1. Pedro Enrique 2013-08-01

    PR: https://github.com/appcelerator/titanium_mobile_blackberry/pull/141
  2. Priya Agarwal 2013-11-12

    Getting this.responseText from Ti.Network.createHTTPClient. Working as expected. Hence closing the issue. Tested Environment: Appcelerator Studio: 3.2.0.201311120707 SDK:3.2.0.v20131111174605 alloy: 1.3.0 acs: 1.0.7 npm: 1.3.2 titanium: 3.2.0 titanium-code-processor: 1.0.3 Xcode:5.0.1 Device: Blackeberry Z 10 OS: Mac OSX 10.9

JSON Source