You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the recommended way to read the request body as a raw string?
Gippety proposed this snippet:
let readRequestBodyAsync (httpContext: HttpContext) : Task<string> =
task {
httpContext.Request.EnableBuffering() // Extension method to enable buffering
httpContext.Request.Body.Position <- 0L // Reset the stream position
use reader = new StreamReader(httpContext.Request.Body)
let! body = reader.ReadToEndAsync() |> Async.AwaitTask
httpContext.Request.Body.Position <- 0L // Reset for any subsequent use
return body
}
This works, but I would assume there is something out of the box in Falco (or ASP.NET Core) to do this.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
What is the recommended way to read the request body as a raw string?
Gippety proposed this snippet:
This works, but I would assume there is something out of the box in Falco (or ASP.NET Core) to do this.
Beta Was this translation helpful? Give feedback.
All reactions