Skip to content

feat(android): option to remove X-Titanium-Id in request header #14221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented May 5, 2025

Currently the httpclient will always set a X-Titanium-Id. You can set it to be a different string or empty but you can't remove it.

This PR will add a propety titaniumId: false so you can disable it. If it is not set it will still be true so it doesn't change anything for users that rely on it.

var url = "httpbin.org/get";
var client = Ti.Network.createHTTPClient({
    onload : function(e) {
        Ti.API.info("Received text: " + this.responseText);
    },
    titaniumId: false, // <--------------- remove the field
    onerror : function(e) {},
    timeout : 5000
});

client.open("GET", url);
// client.setRequestHeader("X-Titanium-Id", null);  // doesn't work
// client.setRequestHeader("X-Titanium-Id", '');  // still there but empty
client.send();

output without the PR:

[INFO]  Received text: {
[INFO]   "args": {},
[INFO]   "headers": {
[INFO]     "Accept-Encoding": "identity",
[INFO]     "Host": "httpbin.org",
[INFO]     "User-Agent": "Titanium SDK/12.7.0 (Pixel 9 Pro; Android API Level: 35; de-DE;)",
[INFO]     "X-Amzn-Trace-Id": "Root=1----",
[INFO]     "X-Titanium-Id": "xxxx-xxxxx-xxxxx-xxxx"                <----- this will be gone
[INFO]   },
[INFO]   "origin": "...",
[INFO]   "url": "http://httpbin.org/get"
[INFO]  }

TODO:
Would be nice to have it here: https://github.com/tidev/titanium-sdk/blob/master/iphone/Classes/TiNetworkHTTPClientProxy.m#L53 for iOS too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant