-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Preserve WebSession.MaximumRedirection from changes #19190
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
Preserve WebSession.MaximumRedirection from changes #19190
Conversation
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Show resolved
Hide resolved
@CarloToso I suggest don't modify existing test and add new one - create |
@CarloToso Please update the PR title and description. |
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Outdated
Show resolved
Hide resolved
…Cmdlet/Common/WebRequestPSCmdlet.Common.cs Co-authored-by: Ilya <darpa@yandex.ru>
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Outdated
Show resolved
Hide resolved
|
||
$session = [Microsoft.PowerShell.Commands.WebRequestSession]::new() | ||
$session.Proxy = [System.Net.WebProxy]::new($proxy) | ||
$null = Invoke-WebRequest -Uri http://httpbin.org -PreserveAuthorizationOnRedirect -WebSession $session -Headers $headers |
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.
We shouldn't use external server for tests.
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.
The same was done in line 2419 with this comment:
# use external url, but with proxy the external url should not actually be called
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.
If possible it must be replaced with our helper.
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.
Up.
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
🎉 Handy links: |
PR Summary
The WebSession.MaximumRedirection parameter shouldn't change as we handle redirections.
This bug appears in edge cases when we use -WebSession -AllowInsecureRedirect -MaximumRedirection together.
Add some tests to check that WebSession doesn't change during usage
PR Context
Fix #19183
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).