(400) Bad Request when trying to post simple value to an API

后端 未结 3 1368
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 19:54

I have this LoansController for a web api

[Route(\"api/[controller]\")]
[ApiController]
public class LoansController : ControllerBase
{
    // G         


        
3条回答
  •  臣服心动
    2020-12-11 20:22

    Try to add headers

    $url = 'http://localhost:1113/api/loans'
    $head = @{'ContentType'='Application/json'}
    Invoke-WebRequest -Uri $url -Body $postParams -Method Post -Headers $head 
    

提交回复
热议问题