Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19129] Windows: HTTPClient does not send User-Agent

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-07-07T18:31:29.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 5.0.0
ComponentsWindows
Labelsn/a
ReporterFokke Zandbergen
AssigneeChristopher Williams
Created2015-07-01T11:04:38.000+0000
Updated2015-09-03T21:51:21.000+0000

Description

The following example shows that on Windows is not sending the User-Agent header (as well as X-Titanium-Id) like iOS and Android do. Many API's require this header to be set.
var win = Ti.UI.createWindow();
var btn = Ti.UI.createButton({
	title: 'Click'
});
btn.addEventListener('click', function (e) {
	var client = Ti.Network.createHTTPClient();
	client.open('GET', 'http://requestb.in/1fv1js61');
	client.send();
});
win.add(btn);
win.open();

Windows

Host: requestb.in
Connection: close
X-Request-Id: 94581c18-95ea-468a-966d-0cf914d68859
Via: 1.1 vegur
Total-Route-Time: 0
Connect-Time: 0
Accept-Encoding: gzip, deflate

iOS

User-Agent: Appcelerator Titanium/4.1.0 (iPhone/8.4; iPhone OS; nl_NL;)
Via: 1.1 vegur
Connection: close
Accept: */*
Accept-Language: nl-nl
X-Request-Id: 600421ac-e5e7-4d10-9c48-2eabfab4489b
Connect-Time: 1
Host: requestb.in
Total-Route-Time: 0
X-Titanium-Id: 92e3ee1a-2507-4c54-b3a0-3af19ccf0661
Accept-Encoding: gzip, deflate
X-Requested-With: XMLHttpRequest

Android

X-Request-Id: e5cd2daa-9796-478f-924c-e8578edd6cdd
X-Requested-With: XMLHttpRequest
X-Titanium-Id: 92e3ee1a-2507-4c54-b3a0-3af19ccf0661
Connection: close
Host: requestb.in
Via: 1.1 vegur
Total-Route-Time: 0
User-Agent: Appcelerator Titanium/4.0.0 (Nexus 5; Android API Level: 22; nl-NL;)
Connect-Time: 0

Comments

  1. Ewan Harris 2015-09-03

    Verified using: Windows 8.1 Appc CLI Core: 5.0.0-33 Appc CLI NPM: 4.2.0-1 Titanium SDK: 5.0.0.v20150902095518 Nokia Lumia 930 8.1 HTTPClient now sends the user agent
       Total-Route-Time: 0
       User-Agent: Appcelerator Titanium/5.0.0.v20150902095518 (NOKIA RM-1045_1044/6.3.9651.0; windowsphone; English_United States.1252;)
       Host: requestb.in
       Accept-Encoding: gzip, deflate
       Connect-Time: 8
       X-Request-Id: 097502e3-758b-4fbb-adec-ebffbb8ce2e7
       Via: 1.1 vegur
       X-Titanium-Id: 3b273aea-496f-4c86-9444-41f3fedfddd3
       Connection: close
       
    Closing ticket

JSON Source