3.39Setting the operation before adding request content

Created on Aug 17, 2026~1 min read

Before assigning the HttpContent instance to the Content property of the HttpRequestMessage object, you can perform some additional pre-processing operations.

cs
HttpRequestBuilder.Post("https://furion.net/")    .SetOnPreSetContent(httpContent =>    {        // Example: set the Content-Disposition request header for the request content        httpContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")        {            Name = multipartFormDataItem.Name,            FileName = multipartFormDataItem.FileName,            Size = multipartFormDataItem.FileSize        };    });

Note: The SetOnPreSetContent method supports multiple calls, and the results of each call are accumulated and combined.