for a single controller api, I'd just create a webapi minimal
% dotnet new webapi -minimal
to get the header:
app.MapPost("api/doit", async (
[FromForm] string p1,
[FromForm] string p2,
[FromForm] string p3,
[FromHeader(Name = "xx-name")] string headerValue ) =>
{
var list = await CreateList(...);
return Results.Ok(list);
});
if you end up with multiple api calls, I use middleware to parse the custom header and update an injected object;
for HttpClient see this thread:
https://stackoverflow.com/questions/35907642/custom-header-to-httpclient-request
and finally if its just a one page app with a simple form. I'd use razor pages instead of Blazor