Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16689] iOS: HTTPClient - On SDK 3.3.0, statusText is returning undefined if you are making an invalid request

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-05-21T22:36:07.000+0000
Affected Version/sRelease 3.3.0
Fix Version/s2014 Sprint 10, 2014 Sprint 10 SDK, Release 3.3.0, Release 3.4.0
ComponentsiOS
Labelsmodule_network, qe-3.3.0, qe-manualtest, qe-testadded, regression
ReporterWilson Luu
AssigneeVishal Duggal
Created2014-03-25T00:47:37.000+0000
Updated2014-08-15T22:58:57.000+0000

Description

*Details:* On SDK 3.3.0 with iOS, statusText is returning undefined if you are making an invalid request. *This is a regression from SDK 3.2.3 and bug does not occur on Android.* *Steps to reproduce:* 1. Create a default Titanium Classic app 2. Add this piece of code:
label1.addEventListener('click', function(e){
	// accepts only POST requests
	var url = 'http://httpbin.org/post';
	
	var client = Ti.Network.createHTTPClient({
		
		onload : function(e) {
			var msg = 'onload: ' + this.responseText;
			Ti.API.info(msg);
			alert(msg);
		},
		
		onerror : function(e) {
			// var msg = 'onerror: ' + 'error code -> ' + e.code + ', error -> ' + e.error;
			var msg = 'onerror: ' + this.statusText;
			Ti.API.error(msg);
			alert(msg);
		},
		
		cache: false
	});
	
	client.open('DELETE', url);
	client.send('DELETE THE MONKEY');
});
3. Install and launch app to device 4. Press on "I am Window 1" label *Actual:* "undefined" is returned in the onerror callback (see 3.3.0_actual.png). *Expected:* "METHOD NOT ALLOWED" message should appear like in SDK 3.2.3 (see 3.2.3_expected.png)

Attachments

FileDateSize
3.2.3_expected.png2014-03-25T00:47:37.000+000063256
3.3.0_actual.png2014-03-25T00:47:37.000+000056978

Comments

  1. Vishal Duggal 2014-05-21

    Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/5722 3_3_X - https://github.com/appcelerator/titanium_mobile/pull/5723
  2. Satyam Sekhri 2014-06-09

    StatusText in onerror callback returns the expected value. Verified on: || Component || Version || | Appcelerator Studio | 3.3.0.201405271647 | | Titanium SDK | 3.3.0.v20140606154912 | | Node | 0.10.28 | | acs | 1.0.14 | | alloy | 1.4.0-beta2 | | npm | 1.4.9 | | CLI | 3.3.0-beta2 | | Titanium-code-processor | 1.1.1 | | OS | OSX 10.9.2 | | Device | iPhone 5S (iOS 7.1) |

JSON Source