mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-11 12:57:42 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b17840cea9 | ||
|
|
969b0da8e2 |
@@ -1,3 +1,7 @@
|
||||
# 1.4.10 (15 April 2021)
|
||||
- [#603](https://github.com/WireMock-Net/WireMock.Net/pull/603) - Fix callback with Headers [bug] contributed by [StefH](https://github.com/StefH)
|
||||
- [#602](https://github.com/WireMock-Net/WireMock.Net/issues/602) - Header not being returned when set in WithCallback [bug]
|
||||
|
||||
# 1.4.9 (31 March 2021)
|
||||
- [#600](https://github.com/WireMock-Net/WireMock.Net/pull/600) - WithProxy() should save the new mapping [bug] contributed by [StefH](https://github.com/StefH)
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.4.9</VersionPrefix>
|
||||
<VersionPrefix>1.4.10</VersionPrefix>
|
||||
<PackageReleaseNotes>See CHANGELOG.md</PackageReleaseNotes>
|
||||
<PackageIconUrl>https://raw.githubusercontent.com/WireMock-Net/WireMock.Net/master/WireMock.Net-Logo.png</PackageIconUrl>
|
||||
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
https://github.com/StefH/GitHubReleaseNotes
|
||||
|
||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 1.4.9
|
||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 1.4.10
|
||||
@@ -392,7 +392,7 @@ namespace WireMock.ResponseBuilders
|
||||
}
|
||||
|
||||
// Copy Headers from ResponseMessage (if defined)
|
||||
if (ResponseMessage.Headers != null)
|
||||
if (ResponseMessage.Headers?.Count > 0)
|
||||
{
|
||||
responseMessage.Headers = ResponseMessage.Headers;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,37 @@ namespace WireMock.Net.Tests.ResponseBuilders
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Response_WithCallback_And_WithStatusCode_And_WithHeader()
|
||||
public async Task Response_WithCallback_ShouldUseStatusCodeAndHeaderInTheCallback()
|
||||
{
|
||||
// Assign
|
||||
var header = "X-UserId";
|
||||
var requestMessage = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1");
|
||||
var responseBuilder = Response.Create()
|
||||
.WithCallback(request => new ResponseMessage
|
||||
{
|
||||
BodyData = new BodyData
|
||||
{
|
||||
DetectedBodyType = BodyType.String,
|
||||
BodyAsString = request.Path + "Bar"
|
||||
},
|
||||
StatusCode = HttpStatusCode.Accepted,
|
||||
Headers = new Dictionary<string, WireMockList<string>>
|
||||
{
|
||||
{ header, new WireMockList<string>("Stef") }
|
||||
}
|
||||
});
|
||||
|
||||
// Act
|
||||
var response = await responseBuilder.ProvideResponseAsync(requestMessage, _settings);
|
||||
|
||||
// Assert
|
||||
response.Message.BodyData.BodyAsString.Should().Be("/fooBar");
|
||||
response.Message.StatusCode.Should().Be(HttpStatusCode.Accepted);
|
||||
response.Message.Headers[header].Should().ContainSingle("Stef");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Response_WithCallback_And_Additional_WithStatusCode_And_WithHeader_ShouldUseAdditional()
|
||||
{
|
||||
// Assign
|
||||
var header = "X-UserId";
|
||||
|
||||
Reference in New Issue
Block a user