Get response from PostAsJsonAsync

后端 未结 5 2011
清歌不尽
清歌不尽 2020-12-08 07:47

I have this line of code

var response = new HttpClient().PostAsJsonAsync(posturi, model).Result;

The Called WebAPI controller returns a bo

5条回答
  •  轮回少年
    2020-12-08 08:35

    If you call the generic version, it should give you back the bool:

    var response = new HttpClient().PostAsJsonAsync(posturi, model).Result;
    

    At least according to the docs.

提交回复
热议问题