3.15Setting Binary Stream Content
Created on Aug 17, 2026~2 min read
Directly sets a Stream as the request content, suitable for file streams, memory streams, network streams, and other scenarios.
// Sets a file streamHttpRequestBuilder.Post("https://furion.net/") .SetStreamContent(File.OpenRead(@"C:\Users\Furion\test.png"));// Sets a file stream and specifies the file name and content typeHttpRequestBuilder.Post("https://furion.net/") .SetStreamContent(File.OpenRead(@"C:\Users\Furion\test.png"), "avatar.png", "image/png");// Sets a memory streamvar memoryStream = new MemoryStream(Encoding.UTF8.GetBytes("Hello Furion"));HttpRequestBuilder.Post("https://furion.net/") .SetStreamContent(memoryStream, contentType: "text/plain");// Sets a stream and specifies the encodingHttpRequestBuilder.Post("https://furion.net/") .SetStreamContent(memoryStream, contentEncoding: Encoding.UTF8);