mockhttp
mockhttp copied to clipboard
NullReferenceException if response is not configured.
If a request is configured, but a response is never configured, a NullReferenceException is thrown when SendAsync is called on the HTTP client. This is confusing to the user and takes some time to unravel what went wrong.
mockHttp.Expect("/foo")
.WithQueryString("bar", "bat")
.WithQueryString("fizz", "buzz");
// forgot to configure response
httpClient.GetAsync("/foo"); // throws NullReferenceException.
I actually just ran into this myself, so I can confirm.
@richardszalay Is there any chance of a new release on Nuget with this fix included?
Verion 7.0.0 includes this change.