You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configuring responses now has a complete overhaul. By using IResponse, it is now possible to create delayed and sequenced responses and in general it is more flexible.
All old response configuration options are deprecated as a result, so tests that use these configurations have to be refactored.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
7
7
## [0.8] - Unplanned
8
+
### Deprecated
9
+
-`TestableHttpMessageHandler.SimulateTimeout` is deprecated, and can be replaced with `RespondWith(Responses.Timeout())`.
10
+
-`TestableHttpMessageHandler.RespondWith(Func<HttpRequestMessage, HttpResponseMessage>)` had been deprecated, it's functionality is replaced by IResponse.
11
+
-`RespondWith(this TestableHttpMessageHandler, HttpResponseMessage)` has been deprecated, the response is modified with every call, so it doesn't work reliably and is different from how HttpClientHandler works, which creates a HttpResponseMessage for every request.
12
+
-`HttpResponseMessageBuilder` and `RespondWith(this TestableHttpMessageHandler, HttpResponseMessageBuilder)` has been deprecated, it's functionality can be replaced with ConfiguredResponse or a custom IResponse.
8
13
9
14
### Added
10
15
-`CreateClient` now accepts `DelegateHandlers` in order to chain Handlers. The InnerHandler property of each handler is set automatically and the `TestableHttpMessageHandler` is automatically set as the last handler. This is showcased with Polly in the integration tests.
11
16
- Added support for .NET Framework 4.6.2, .NET Framework 4.7 and .NET Framework 4.8 by running the tests against these versions.
17
+
- Added several `Responses`, including `Delayed`, `Timeout`, `Configured`, `Sequenced`, `StatusCode` and `Json`. These responses can now be used inside the `RespondWith`.
18
+
19
+
### Changed
20
+
-`TestableHttpClient` now works with the `Responses` class, making it easier to configure responses.
21
+
- When `HttpResponseMessage.Content` is null after `IResponse.ExecuteAsync` was called, an empty `StringContent` is added (Up until .NET 6.0, since Content is always filled there).
22
+
- The `HttpRequestMessage` is always added to the response, which is now possible, since we no longer allow reusing responses.
23
+
- Added `ConfigureAwait(false)` to all calls, since we now use async/await in the library.
Copy file name to clipboardExpand all lines: src/TestableHttpClient/HttpResponseMessageBuilder.cs
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,23 @@ namespace TestableHttpClient;
6
6
/// This class helps creating an <see cref="HttpResponseMessage"/> using a fluent interface.
7
7
/// </summary>
8
8
[SuppressMessage("Design","CA1001:Types that own disposable fields should be disposable",Justification="The HttpResponseMessage is only created and passed to the consumer.")]
9
+
[Obsolete("Use ConfiguredResponse or a custom IResponse instead.")]
0 commit comments