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 a team as a code owner January 7, 2022 20:17
@jedieaston
Copy link
Contributor

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

@JohnMcPMS
Copy link
Member Author

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

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
@JohnMcPMS JohnMcPMS deleted the useragent branch January 20, 2022 22:26
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.

3 participants