Search code examples
c#dotnet-httpclienthttp-patch

How do I do a patch request using HttpClient in dotnet core?


I am trying to create a Patch request with theHttpClient in dotnet core. I have found the other methods,

using (var client = new HttpClient())
{
    client.GetAsync("/posts");
    client.PostAsync("/posts", ...);
    client.PutAsync("/posts", ...);
    client.DeleteAsync("/posts");
}

but can't seem to find the Patch option. Is it possible to do a Patch request with the HttpClient? If so, can someone show me an example how to do it?


Solution

  • As of Feb 2022 Update 2022

    ###Original Answer###

    As of .Net Core 2.1, the PatchAsync() is now available for HttpClient

    Snapshot for applies to

    Reference: https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.patchasync