The API I'm trying to call requires that I do a POST but with an empty body. I'm new to using the WCF Web API HttpClient and I can't seem to find out the write code that would do a post with an empty body. I find references to some HttpContent.CreateEmpty() method, but I don't think that is for the Web API HttpClient code since I can't seem to find that method.
C# – Post an empty body to REST API via HttpClient
chttpclientwcfwcf-web-api
Related Topic
- C# – POSTing JsonObject With HttpClient From Web API
- C# – reason for C#’s reuse of the variable in a foreach
- C# – Try-catch speeding up the code
- C# – How to call asynchronous method from synchronous method in C#
- C# – How and when to use ‘async’ and ‘await’
- C# – \d less efficient than [0-9]
- Scala: list.flatten: no implicit argument matching parameter type (Any) = > Iterable[Any] was found
Best Answer
Use
StringContent
orObjectContent
which derive fromHttpContent
or you can usenull
asHttpContent
: