Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17585] Android: HTTPClient: Invalid Status Codes returned in 3.3.0.GA SDK

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-09-15T17:37:34.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 3.4.0, Release 3.5.0
ComponentsAndroid
LabelsTCSupport, module_network, qe-testadded
ReporterMatthew Delmarter
AssigneeHieu Pham
Created2014-09-01T22:18:50.000+0000
Updated2018-11-13T12:03:35.000+0000

Description

Problem Description

When a GET request should be returning a status of "301" or "302", I have the 3.3.0 GA SDK returning a "200". Switching back to the 3.2.3 GA SDK fixes the problem. When we have tested using the following code, the status returned is "302" in 3.3.0.GA and "301" in 3.2.3.GA.

Steps to reproduce

a) Create a simple project. b) Update this code in app.js:
var xhr = Titanium.Network.createHTTPClient();
xhr.autoRedirect = false;
xhr.allResponseHeaders = true;

// what to do if it loads
xhr.onload = function(e) {

	Ti.API.log('Status = ' + this.getStatus());

	if (this.getStatus() == 301) {
		Ti.API.log('Redirect to ' + this.getResponseHeader('location'));
	} else {
		Ti.API.log('This should have returned a 301 not a 200');
	}
};

xhr.open('GET', 'http://google.co.nz');
xhr.send();
c) Run this with testing environment

Test results

In Titanium SDK: 3.3.0.GA [DEBUG]: Application booted in 125.191987 ms [INFO] : Status = 302 [INFO] : This should have returned a 301 not a 200 In Titanium SDK: 3.2.3.GA [DEBUG]: Application booted in 110.395968 ms [INFO] : Status = 301 [INFO] : Redirect to http://www.google.co.nz/

Comments

  1. Ingo Muschenetz 2014-09-02

    [~emerriman] To find duplicate.
  2. Hieu Pham 2014-09-11

    master PR: https://github.com/appcelerator/titanium_mobile/pull/6053 3.4.X PR: https://github.com/appcelerator/titanium_mobile/pull/6054
  3. Lokesh Choudhary 2014-09-12

    Verified the fix. The right code is returned as below:
       [INFO] :   Status = 301
       [INFO] :   Redirect to http://www.google.co.nz/
       
    Closing. Environment: Appc Studio : 3.4.0.201409112242 Ti SDK : 3.4.0.v20140912084114 Mac OSX : 10.9.4 Alloy : 1.5.0-rc CLI - 3.4.0-rc2 Code Processor: 1.1.1 Galaxy S4 - android 4.4.2

JSON Source