-
Notifications
You must be signed in to change notification settings - Fork 8.1k
WebCmdlets fix issue with -Body and no -ContentType #23952
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
Conversation
...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
…s.Tests.ps1 Co-authored-by: Ilya <darpa@yandex.ru>
@iSazonov I'm not familiar with the CI setup here. I clicked through to Azure DevOps and found this: I downloaded it, launched, and it said it was From there, I ran the exact same test. On PowerShell 7.4.2 (windows x64) I get I do not see any log entries on my local test server; PowerShell never sends the request. On the 7.5.0-preview.4 pull request build, I do not get the error. The logs on my local server confirm that PowerShell is sending the request and the behaviour looks similar to older versions of PowerShell where this worked. Thank you! For reference: My repro is fairly simple: I have a local aspnetcore webserver (but any HTTP API server will do) and I'm sending a JSON PUT as follows: $header = @{}
$body = '{ }' // actual body content is specific to my webserver, but is irrelevant for the repro
Invoke-RestMethod -Method Put -Uri "<local server URI>" -Body $body -Headers $header |
|
We will wait for a preview release with this change before backporting to 7.4 |
|
@PowerShell/powershell-maintainers |
PR Summary
I reproduced the issue with every method except POST; now it should work correctly
In PS 7.4 and 7.4.1 PUT had the same behaviour as POST, so it worked without issues
Added some tests (checked with curl)
PR Context
Fixes #23827
@iSazonov
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.- [ ] Issue filed:
(which runs in a different PS Host).