mockhttp icon indicating copy to clipboard operation
mockhttp copied to clipboard

NullReferenceException if response is not configured.

Open perfectsquircle opened this issue 4 years ago • 1 comments

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.

perfectsquircle avatar May 04 '21 16:05 perfectsquircle

I actually just ran into this myself, so I can confirm.

0x326 avatar Sep 15 '22 21:09 0x326

@richardszalay Is there any chance of a new release on Nuget with this fix included?

FroggieFrog avatar Feb 16 '23 12:02 FroggieFrog

Verion 7.0.0 includes this change.

richardszalay avatar Oct 12 '23 10:10 richardszalay