richardszalay/mockhttp

HttpClient and HttpResponseHandler "Respond" extensions don't actually work properly

Closed this issue · 3 comments

c70bf4f

Your tests directly invoke the "SendAsync" method of your custom handler, thus they pass; however, utilizing your custom handler within an HttpClient and attempting to pass the request to a different HttpClient/Handler will fail with the following error:

The request message was already sent. Cannot send the same request message multiple times.

Am I not understanding the correct usage of these extension methods or is this an accidental oversight?

That's a really good point - I'd say it's an oversight.

Let me look into the HttpClient source to see if there's a logical way of working around the issue.

This has been fixed but is blocked by #41 as without that I can't get a release out.

This is fixed in 1.5.1 (just released)