File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/FSharp.Data.GraphQL.Server.AspNetCore/Giraffe Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11namespace FSharp.Data.GraphQL.Server.AspNetCore.Giraffe
22
33open System
4+ open System.Buffers
45open System.IO
56open System.Text .Json
67open System.Text .Json .Serialization
@@ -154,10 +155,13 @@ module HttpHandlers =
154155 else
155156 request.EnableBuffering()
156157 let body = request.Body
157- let buffer = Array.zeroCreate 1
158- let! bytesRead = body.ReadAsync( buffer, 0 , 1 )
159- body.Seek( 0 , SeekOrigin.Begin) |> ignore
160- return bytesRead > 0
158+ let buffer = ArrayPool.Shared.Rent 1
159+ try
160+ let! bytesRead = body.ReadAsync( buffer, 0 , 1 )
161+ body.Seek( 0 , SeekOrigin.Begin) |> ignore
162+ return bytesRead > 0
163+ finally
164+ ArrayPool.Shared.Return buffer
161165 }
162166
163167 /// <summary>Check if the request is an introspection query
You can’t perform that action at this time.
0 commit comments