Skip to content

v4.0.0

Compare
Choose a tag to compare
@skwasjer skwasjer released this 03 Jan 00:17
· 104 commits to main since this release

What's Changed

  • Add new Fluent response API by @skwasjer in #10 See also #9
    This is a complete replacement of the old response builder API's, and thus likely will require you to refactor your tests (I'm sorry but such is the price of improvement sometimes :( ). See wiki for new API docs/examples. The request matching API's have largely stayed the same, but some extension methods were renamed for consistency. E.g.:
    MockHttpHandler mockHttp = new MockHttpHandler();
    
    // Configure setup(s).
    mockHttp
        .When(matching => matching
            .Method("GET")
            .RequestUri("http://localhost/controller/*")
            .QueryString("id", 123)
        )
        .Respond(with => with
            .StatusCode(200)
            .JsonBody(new { id = 123, firstName = "John", lastName = "Doe" })
        )
        .Verifiable();
    The new response API also comes with some new features/improvements:
    • .ClientTimeout(100.Milliseconds())
    • .ServerTimeout(100.Milliseconds())
    • .Latency(NetworkLatency.FiveG)
  • Added .NET 7 target framework
  • Add stream that rate limits response streams. by @skwasjer in #17 E.g.:
    using Stream stream = File.OpenRead(...); // A big stream
    
    mockHttpHandler
        .When(matching => ...)
        .Respond(with => with.Body(() => new RateLimitedStream(stream, 512000))); // Rate limited to 512 kbps
  • Additional guards (Argument(Null)Exception) for certain extensions.
  • Fix static code analysis warnings.
  • Bump Microsoft.AspNet.WebApi.Client from 5.2.7 to 5.2.9 by @dependabot in #23
  • Enable nullable by @skwasjer in #27
  • Remove obsolete/deprecated code by @skwasjer in #16

Full Changelog: v3.0.1...v4.0.0

The changes above were previously pre-released as v3.1.0-rcXXX but there are numerous (breaking) changes that warrant a major release.