3.19Setting Request Headers
Created on Aug 17, 2026~2 min read
Adds or modifies request headers.
HttpRequestBuilder.Get("https://furion.net/") .WithHeader("X-Header", "X-Value") // Add a single header .WithHeader("date", DateTime.Now, format: "yyyyMMdd") // Supports format formatting .WithHeaders(new Dictionary<string, object?> { }) // Add multiple headers .WithHeaders(new { id = 1, name = "Furion" }) // Add multiple headers, supporting multiple key-value types .WithHeaders("Content-Type: application/json"); // Supports configuration using a colon (:)If duplicate request headers exist, they are merged, and multiple values are separated by a comma followed by a space (, ). By setting the replace: true parameter, you can override previously set request headers.