Reputation: 129
For some reason when request is sent through Swagger it goes through without any issues
But when I try to do the same thing with powershell I get 400
curl -Method Post -Uri "http://localhost:32774/WeatherForecast" -Headers @{ accept = '*/*';"Content-Type" ="application/json" } -Body "test"
What can I do to fix it?
Upvotes: 0
Views: 68
Reputation: 129
Sending post though Powershell curl
This comment is the answer. What I was missing were quotes in body. I wish I could mark the comment as answer.
Upvotes: 1
Reputation: 173
Try
$response = Invoke-RestMethod -Uri "http://localhost:32774/WeatherForecast" -Method POST -Headers @{ accept = '*/*' } -ContentType 'application/json'
Upvotes: 0