Remove comment and simplify condition in WebCmdlets#19251
Remove comment and simplify condition in WebCmdlets#19251iSazonov merged 4 commits intoPowerShell:masterfrom
Conversation
| { | ||
| // If both ProxyCredential and ProxyUseDefaultCredentials are passed, | ||
| // UseDefaultCredentials will overwrite the supplied credentials. | ||
| webProxy.UseDefaultCredentials = true; |
There was a problem hiding this comment.
Hmm, I think really the comment is correct since we can iwr -UseDefaultCredentials:$false -Credentials $cred
Perhaps it makes sense to remove the if
else
{
// If both ProxyCredential and ProxyUseDefaultCredentials are passed,
// UseDefaultCredentials will overwrite the supplied credentials.
webProxy.UseDefaultCredentials = ProxyUseDefaultCredentials;
}There was a problem hiding this comment.
No this is wrong, we have both -Credentials -UseDefaultCredentials (for Authentication) and -ProxyCredentials -ProxyUseDefaultCredentials (for Proxy)
There was a problem hiding this comment.
I updated my proposal above.
Also please remove last commit as unrelated the PR.
There was a problem hiding this comment.
Cases:
iwr -Proxy $proxy
#GOOD proxy with no credentials
iwr -Proxy $proxy -ProxyCredential $credentials
#GOOD proxy with credentials
iwr -Proxy $proxy -ProxyUseDefaultCredentials:$true
#GOOD proxy with default credentials
iwr -Proxy $proxy -ProxyUseDefaultCredentials:$false
#GOOD proxy with no credentials
iwr -Proxy $proxy -ProxyCredential $credentials -ProxyUseDefaultCredentials:$true
#ERROR conflicting parameters
iwr -Proxy $proxy -ProxyCredential $credentials -ProxyUseDefaultCredentials:$false
#GOOD but redundant proxy with credentials
iwr -ProxyCredential $credentials -ProxyUseDefaultCredentials
#ERROR no proxyI think we could implement your proposal but it won't change the current behaviour and we should still remove the comment
There was a problem hiding this comment.
It seems the comment is not add critical information. So I suggest:
else
{
webProxy.UseDefaultCredentials = ProxyUseDefaultCredentials;
}|
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
Remove wrong comment.
We can't use both parameters toghether because of
ValidateParameters()line 736PR Context
Found in #19173 @iSazonov @stevenebutler
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).