Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19591] createHttpClient GET request, when 404 Android onError http error code not received

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionCannot Reproduce
Resolution Date2019-12-09T18:10:54.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labels404, GET, code, createHttpClient, error
Reportereric harms
AssigneeUnknown
Created2014-10-10T21:21:18.000+0000
Updated2019-12-09T18:10:54.000+0000

Description

Create a new httpClient request, GET. In the onError callback ask for the http response code. Purposely make the URL to send a 404 not found IOS, simulator and device, you will get the 404 code, and any error handling will execute. Android will fail on both simulator and device. Http code returned is -1. You will also see an httpclient error in the console.

var dataUrl = "http://www.whateverdomain.com/404page"; // add your 404 test URL here

function httptest()
{
	
	var xhr = Ti.Network.createHTTPClient({
		onload: function()
		{
			// whatever....
		},
		onerror: function(e) {
			Ti.API.info(e.code);
		},
		timeout: 60000
	
	});
	
	xhr.open('GET', dataUrl);
	xhr.send();
}

function init()
{
	$.index.open();
	 httptest();
}

init();



Comments

  1. Alan Hutton 2019-12-09

    nable to reproduce. Received the same 404 error on both iOS and Android. Axway Appcelerator Studio, build: 5.1.4.201909061933  macOS : 10.15 Node.js Version : 8.9.1 npm Version : 5.5.1 Appcelerator CLI : 7.1.2 Titanium CLI CLI Version : 5.2.1 node-appc Version : 0.2.49 Titanium SDKs : 8.3.0.GA iPhone 11 13.2.2 Pixel 3 Android API 29

JSON Source