diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 50c64f2d..60a9ed31 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,12 @@ Release Notes ============= +## 0.1.0-beta-511 + +#### Bug fixes + +- Fixed `ReadBodyFromRequestAsync` where the stream has been disposed before read could complete. + ## 0.1.0-beta-510 #### Improvements diff --git a/src/Giraffe/Giraffe.fsproj b/src/Giraffe/Giraffe.fsproj index 9cfecbde..a6b82ac5 100644 --- a/src/Giraffe/Giraffe.fsproj +++ b/src/Giraffe/Giraffe.fsproj @@ -2,7 +2,7 @@ Giraffe - 0.1.0-beta-510 + 0.1.0-beta-511 A native functional ASP.NET Core web framework for F# developers. Copyright 2017 Dustin Moris Gorski en-GB diff --git a/src/Giraffe/HttpContextExtensions.fs b/src/Giraffe/HttpContextExtensions.fs index 78dee7b6..c712a451 100644 --- a/src/Giraffe/HttpContextExtensions.fs +++ b/src/Giraffe/HttpContextExtensions.fs @@ -61,8 +61,10 @@ type HttpContext with /// --------------------------- member this.ReadBodyFromRequestAsync() = - use reader = new StreamReader(this.Request.Body, Text.Encoding.UTF8) - reader.ReadToEndAsync() + task { + use reader = new StreamReader(this.Request.Body, Text.Encoding.UTF8) + return! reader.ReadToEndAsync() + } member this.BindJsonAsync<'T>() = this.BindJsonAsync<'T> defaultJsonSerializerSettings