diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 339fc2e3..de68c54e 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,6 +1,10 @@
Release Notes
=============
+## 5.0.0-rc-3
+
+- Added `ReadBodyBufferedFromRequestAsync` extension method to buffer and read a the request body and make subsequent reads possible (see [#449](https://github.com/giraffe-fsharp/Giraffe/issues/449))
+
## 5.0.0-rc-2
- Fixed pre-conditions validation issue (see [#424](https://github.com/giraffe-fsharp/Giraffe/issues/424))
diff --git a/src/Giraffe/ModelBinding.fs b/src/Giraffe/ModelBinding.fs
index 6c047076..a14ce434 100644
--- a/src/Giraffe/ModelBinding.fs
+++ b/src/Giraffe/ModelBinding.fs
@@ -365,6 +365,25 @@ type HttpContext with
return! reader.ReadToEndAsync()
}
+ ///
+ /// Reads the entire body of the asynchronously and returns it as a value.
+ /// This method buffers the response and makes subsequent reads possible.
+ ///
+ /// Returns the contents of the request body as a .
+ member this.ReadBodyBufferedFromRequestAsync() =
+ task {
+ this.Request.EnableBuffering()
+ use reader =
+ new StreamReader(
+ this.Request.Body,
+ encoding = Encoding.UTF8,
+ detectEncodingFromByteOrderMarks = false,
+ leaveOpen = true)
+ let! body = reader.ReadToEndAsync()
+ this.Request.Body.Position <- 0L
+ return body
+ }
+
///
/// Uses the to deserializes the entire body of the asynchronously into an object of type 'T.
///