json - c# httpclient PostAsJson sending GET request instead of POST -
i using httpclient make post request. 405 method not allowed. when capturing trace in fiddler, goes out instead of post!
using (var client = new httpclient()) { var url = appsettingsutil.getstring("url"); var response = client.postasjsonasync(url, transaction).result; } i aware of async/await issues. simplified sample show issue.
is there sort of web.config or machine.config setting affecting this? other requests (sent through restsharp) send posts correctly
here fiddler captures. rerunning trace in fiddler returns 405 (as expected). manually switching post , running works fiddler.
also, perhaps because method switched get, there no body captured in fiddler, had manually paste in json
get /*url*/ http/1.1 content-type: application/json; charset=utf-8 host: /*host*/ connection: keep-alive
the problem appears changed url without telling us, , put redirect in place. httpclient responding redirect, ends sending request final destination get.
this seems bug in httpclient me, should either send ultimate request post, or throw exception saying can't asked to.
Comments
Post a Comment