I have server side Hub with the following code:
private string GetUserPhoneFromContext()
{
var httpCtx = Context.GetHttpContext();
return httpCtx.Request.Headers["userPhone"].ToString();
}
Mention above code I can't change it works on prod with flutter clients. I am developing blazor wasm client side and on client side I want to add headers as follow:
hubConnection = new HubConnectionBuilder()
.WithUrl($"{Uri}?userPhone={Phone}", options =>
{
options.Headers.Add("userPhone", Phone);
})
.WithAutomaticReconnect()
.Build();
But nor via options.Header.Add() neither via adding query string parameter I can't read header on the server side via GetUserPhoneFromContext method, I always get empty string instead of added on client userPhone header. Not clearly understand why it works with flutter clients but does not work with .net blazor wasm