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/
[~emerriman] To find duplicate.
master PR: https://github.com/appcelerator/titanium_mobile/pull/6053 3.4.X PR: https://github.com/appcelerator/titanium_mobile/pull/6054
Verified the fix. The right code is returned as below:
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