C#C
C#17mo ago
Matheus

Body request

hey there, I'm trying to get the body with this method
public async Task<string?> ReadRequestBodyAsync(HttpRequest request)
{
    request.EnableBuffering();

    if (request.Body == null)
    {
        throw new ArgumentNullException(nameof(request.Body), "Request body is null.");
    }

    using (var reader = new StreamReader(request.Body, Encoding.UTF8, leaveOpen: true))
    {
        var body = await reader.ReadToEndAsync();
        return body;
    }
    

}

but when i will go to see the parameters, don't contain the body and I'm using HttpRequest to do this, exist another way to do this?
image.png
Was this page helpful?