I am having one single service that is hosing both API controllers and GRPC with dot net core 3.1. I have middlewares that need to work for both (API and GRPC) and I have a need to read Request Body in it. I tried the below approach, where it works fine for API requests, but its not working in case of grpc. When I read stream I get unicode chars in it for grpc request payloads like this "\0\0\0\0�\n�\u0001".
httpContext.Request.EnableBuffering();
var reqVal = await new StreamReader(httpContext.Request.Body).ReadToEndAsync();
httpContext.Request.Body.Position = 0;