Sitelet https://web.archive.org/web/20220312080414/https://github.com/microsoft/winget-cli/pull/1839
Skip to content
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

Add a default user agent to REST source calls #1839

Merged
merged 3 commits into from Jan 20, 2022

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Jan 7, 2022 •

Change

Provides a default user agent header in the http helper class that the REST source code uses. It can be overridden by providing the user agent header in the headers argument.

The default format is:

winget-cli WindowsPackageManager/1.2.3 DesktopAppInstaller/10.11.12

where 1.2.3 is the client version as would be output by winget -v (without the v at the beginning) and 10.11.12 is the package version of the MSIX.

Also updates the WinINET downloader to use the same user agent string, but it is not overridable.

Validation

Added a unit test to ensure that the default was being set properly for both GET and POST.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS JohnMcPMS requested a review from as a code owner Jan 7, 2022
@jedieaston
Copy link
Contributor

@jedieaston jedieaston commented Jan 10, 2022

The WinINet downloader uses the user-agent winget-cli (see here), should that be switched to WPM/<version> too?

@JohnMcPMS
Copy link
Member Author

@JohnMcPMS JohnMcPMS commented Jan 10, 2022

The WinINet downloader uses the user-agent winget-cli (see here), should that be switched to WPM/<version> too?

I will take @denelon 's 👍 as an indication that he thinks so. I was indifferent, but will update the PR accordingly.

@JohnMcPMS
Copy link
Member Author

@JohnMcPMS JohnMcPMS commented Jan 19, 2022

Based on some internal discussion with @denelon, I've updated the actual user agent string (see PR description for new format). It will still be used in the same locations.

@JohnMcPMS JohnMcPMS merged commit f33afcb into microsoft:master Jan 20, 2022
5 checks passed
@JohnMcPMS JohnMcPMS deleted the useragent branch Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants