c# httpclient PostAsJson sending GET request instead of POST

前端 未结 1 542
有刺的猬
有刺的猬 2020-12-17 00:29

I am using HttpClient to make a post request. I get back 405 method not allowed. When capturing a trace in fiddler, it goes out as GET instead of POST!

using         


        
相关标签:
1条回答
  • 2020-12-17 01:02

    The problem appears to be that someone changed the URL without telling us, and they put a redirect in place. HttpClient is responding to the redirect, but ends up actually sending the request to the final destination as a Get.

    This seems like a bug in HttpClient to me, that it should either send the ultimate request as a Post, or throw an exception saying it can't do what I asked it to.

    0 讨论(0)
提交回复
热议问题