fix(electron): use includes() instead of in operator for hostname check

The `in` operator checks for array indices, not values, so the condition
was always false. This prevented User-Agent header removal for GitHub,
Office365, and Outlook requests.
This commit is contained in:
Johannes Millan 2025-12-15 10:02:13 +01:00
parent 5ca64347ef
commit 52fd0dfc75

View file

@ -158,7 +158,9 @@ export const createWindow = async ({
// NOTE this is needed for GitHub api requests to work :(
// office365 needs a User-Agent as well (#4677)
if (
new URL(details.url).hostname in ['github.com', 'office365.com', 'outlook.live.com']
['github.com', 'office365.com', 'outlook.live.com'].includes(
new URL(details.url).hostname,
)
) {
removeKeyInAnyCase(requestHeaders, 'User-Agent');
}