-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Platform should return cross platform values under PSUserAgent #4945
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,4 +40,10 @@ Describe "Environment-Variables" -Tags "CI" { | |||||||||||||||||||||||||
| $ENV:TESTENVIRONMENTVARIABLE | Should Be $expected | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| It "User Agent should reflect current plafformID" { | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test should be in |
||||||||||||||||||||||||||
| $bingdings = [System.Reflection.BindingFlags]::NonPublic -bxor [System.Reflection.BindingFlags]::Static | ||||||||||||||||||||||||||
| $platform = [Microsoft.PowerShell.Commands.PSUserAgent].GetProperty('Platform',$bingdings).GetValue($null,$null) | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably not use reflection. Instead we should make a web call and ensure the PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 Lines 456 to 467 in b07f24e
|
||||||||||||||||||||||||||
| $platform | Should BeExactly $PSVersionTable.platform | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wont work.
System.Platformiddoes not contain commonly accepted values for the platform part of aUser-Agentheader. For example, macOS should beMacintoshand all (recent) Windows should beWindows NT, and most Linux should beLinuxorX11.