File tree Expand file tree Collapse file tree
WoofWare.Myriad.Plugins.Test/TestHttpClient Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,8 +88,11 @@ module TestBodyParam =
8888 let proc ( message : HttpRequestMessage ) : HttpResponseMessage Async =
8989 async {
9090 message.Method |> shouldEqual HttpMethod.Post
91- let! content = message.Content.ReadAsStreamAsync () |> Async.AwaitTask
92- let content = new StreamContent ( content)
91+ // Materialise the request body into an independent buffer: the caller owns the request message
92+ // (and hence its content), and will dispose it once we return. Aliasing the request's own
93+ // content stream into the response would leave us reading a disposed stream.
94+ let! content = message.Content.ReadAsByteArrayAsync () |> Async.AwaitTask
95+ let content = new ByteArrayContent ( content)
9396 let resp = new HttpResponseMessage ( HttpStatusCode.OK)
9497 resp.Content <- content
9598 return resp
You can’t perform that action at this time.
0 commit comments