Skip to content

Commit 1a375af

Browse files
committed
Fix the other tests
1 parent 9325f7d commit 1a375af

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

WoofWare.Myriad.Plugins.Test/TestHttpClient/TestBodyParam.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)