3.62Removing the Default Content-Type of Content

Created on Aug 17, 2026~1 min read

When integrating with some older HTTP services, setting the Content-Type request header when sending request content may cause request handling exceptions. Modern HTTP interfaces usually do not have such limitations.

If you need to remove the Content-Type request header corresponding to the request content when sending a request, you can configure it as follows:

cs
HttpRequestBuilder.Post("https://furion.net")    .SetOmitContentType(true);  // Remove the content's default Content-Type

In addition to the method above, another approach is to use the SetOnPreSetContent(Action<HttpContent>) method to modify the request headers before setting the request content, setting Content-Type to null:

cs
HttpRequestBuilder.Post("https://furion.net")    .SetOnPreSetContent(httpContent =>    {        httpContent.Headers.ContentType = null;    });