mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-05-07 00:14:15 +02:00
Compare commits
3 Commits
1.1.8.0
...
WireMockSe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e6eb256f5 | ||
|
|
2851c820e0 | ||
|
|
13ab37dd3e |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,14 +1,18 @@
|
|||||||
|
# 1.1.9.0 (25 February 2020)
|
||||||
|
- [#431](https://github.com/WireMock-Net/WireMock.Net/pull/431) - Fix LinqMatcher for JSON int64 [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#425](https://github.com/WireMock-Net/WireMock.Net/issues/425) - Allow 64 bit numbers in JSON [bug]
|
||||||
|
|
||||||
# 1.1.8.0 (22 February 2020)
|
# 1.1.8.0 (22 February 2020)
|
||||||
- [#419](https://github.com/WireMock-Net/WireMock.Net/pull/419) - Support multi line wild card matching [bug] contributed by [thewholuver94](https://github.com/thewholuver94)
|
- [#419](https://github.com/WireMock-Net/WireMock.Net/pull/419) - Support multi line wild card matching [bug] contributed by [NoahLerner](https://github.com/NoahLerner)
|
||||||
- [#421](https://github.com/WireMock-Net/WireMock.Net/pull/421) - Fix: do not return empty matchers array when Func has been used [bug] contributed by [StefH](https://github.com/StefH)
|
- [#421](https://github.com/WireMock-Net/WireMock.Net/pull/421) - Fix: do not return empty matchers array when Func has been used [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#423](https://github.com/WireMock-Net/WireMock.Net/pull/423) - Fixes for Cookie and Header Reject on Match [bug] contributed by [StefH](https://github.com/StefH)
|
- [#423](https://github.com/WireMock-Net/WireMock.Net/pull/423) - Fixes for Cookie and Header Reject on Match [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#424](https://github.com/WireMock-Net/WireMock.Net/pull/424) - Don't return empty dictionary object for response headers in JSON mapping [feature] contributed by [StefH](https://github.com/StefH)
|
- [#424](https://github.com/WireMock-Net/WireMock.Net/pull/424) - Don't return empty dictionary object for response headers in JSON mapping [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#418](https://github.com/WireMock-Net/WireMock.Net/issues/418) - Body matching fails if body has newline [bug]
|
- [#418](https://github.com/WireMock-Net/WireMock.Net/issues/418) - Body matching fails if body has newline [bug]
|
||||||
|
|
||||||
# 1.1.7.0 (06 February 2020)
|
# 1.1.7.0 (06 February 2020)
|
||||||
- [#409](https://github.com/WireMock-Net/WireMock.Net/pull/409) - Admin Delete with mappings in body [feature] contributed by [thewholuver94](https://github.com/thewholuver94)
|
- [#409](https://github.com/WireMock-Net/WireMock.Net/pull/409) - Admin Delete with mappings in body [feature] contributed by [NoahLerner](https://github.com/NoahLerner)
|
||||||
- [#411](https://github.com/WireMock-Net/WireMock.Net/pull/411) - Improved relative path checking based on file existence [feature] contributed by [thewholuver94](https://github.com/thewholuver94)
|
- [#411](https://github.com/WireMock-Net/WireMock.Net/pull/411) - Improved relative path checking based on file existence [feature] contributed by [NoahLerner](https://github.com/NoahLerner)
|
||||||
- [#413](https://github.com/WireMock-Net/WireMock.Net/pull/413) - Fix new Delete with body missing from IWireMockAdminApi interface contributed by [thewholuver94](https://github.com/thewholuver94)
|
- [#413](https://github.com/WireMock-Net/WireMock.Net/pull/413) - Fix new Delete with body missing from IWireMockAdminApi interface contributed by [NoahLerner](https://github.com/NoahLerner)
|
||||||
- [#414](https://github.com/WireMock-Net/WireMock.Net/pull/414) - Fix logger in StandAlone [bug] contributed by [StefH](https://github.com/StefH)
|
- [#414](https://github.com/WireMock-Net/WireMock.Net/pull/414) - Fix logger in StandAlone [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#412](https://github.com/WireMock-Net/WireMock.Net/issues/412) - WireMock Standalone - null reference exception since settings.Logger [bug]
|
- [#412](https://github.com/WireMock-Net/WireMock.Net/issues/412) - WireMock Standalone - null reference exception since settings.Logger [bug]
|
||||||
|
|
||||||
@@ -59,7 +63,7 @@
|
|||||||
- [#386](https://github.com/WireMock-Net/WireMock.Net/issues/386) - Is transforming contents of XML file supported.? [bug]
|
- [#386](https://github.com/WireMock-Net/WireMock.Net/issues/386) - Is transforming contents of XML file supported.? [bug]
|
||||||
|
|
||||||
# 1.0.38.0 (30 November 2019)
|
# 1.0.38.0 (30 November 2019)
|
||||||
- [#376](https://github.com/WireMock-Net/WireMock.Net/pull/376) - Support int values for states and scenario naming [feature] contributed by [thewholuver94](https://github.com/thewholuver94)
|
- [#376](https://github.com/WireMock-Net/WireMock.Net/pull/376) - Support int values for states and scenario naming [feature] contributed by [NoahLerner](https://github.com/NoahLerner)
|
||||||
- [#378](https://github.com/WireMock-Net/WireMock.Net/pull/378) - Set handlebars dependency for .net 4.5.1 to fixed value [bug] contributed by [StefH](https://github.com/StefH)
|
- [#378](https://github.com/WireMock-Net/WireMock.Net/pull/378) - Set handlebars dependency for .net 4.5.1 to fixed value [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#381](https://github.com/WireMock-Net/WireMock.Net/pull/381) - Use dotnet default development certificate for .NET Core 2.x [feature] contributed by [StefH](https://github.com/StefH)
|
- [#381](https://github.com/WireMock-Net/WireMock.Net/pull/381) - Use dotnet default development certificate for .NET Core 2.x [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#377](https://github.com/WireMock-Net/WireMock.Net/issues/377) - Unable to build against .NET 4.5.1 because of Handlebars [bug]
|
- [#377](https://github.com/WireMock-Net/WireMock.Net/issues/377) - Unable to build against .NET 4.5.1 because of Handlebars [bug]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>1.1.8</VersionPrefix>
|
<VersionPrefix>1.1.9</VersionPrefix>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Choose>
|
<Choose>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
https://github.com/StefH/GitHubReleaseNotes
|
https://github.com/StefH/GitHubReleaseNotes
|
||||||
|
|
||||||
GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 1.1.8.0
|
GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 1.1.9.0
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using WireMock.Http;
|
using WireMock.Http;
|
||||||
using WireMock.ResponseProviders;
|
using WireMock.ResponseProviders;
|
||||||
using WireMock.Settings;
|
using WireMock.Settings;
|
||||||
@@ -341,25 +339,6 @@ namespace WireMock.ResponseBuilders
|
|||||||
await Task.Delay(Delay.Value);
|
await Task.Delay(Delay.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Callback != null)
|
|
||||||
{
|
|
||||||
var callbackResponseMessage = Callback(requestMessage);
|
|
||||||
|
|
||||||
if (!WithCallbackUsed)
|
|
||||||
{
|
|
||||||
// Copy StatusCode from ResponseMessage
|
|
||||||
callbackResponseMessage.StatusCode = ResponseMessage.StatusCode;
|
|
||||||
|
|
||||||
// Copy Headers from ResponseMessage (if defined)
|
|
||||||
if (ResponseMessage.Headers != null)
|
|
||||||
{
|
|
||||||
callbackResponseMessage.Headers = ResponseMessage.Headers;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return callbackResponseMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ProxyUrl != null && _httpClientForProxy != null)
|
if (ProxyUrl != null && _httpClientForProxy != null)
|
||||||
{
|
{
|
||||||
var requestUri = new Uri(requestMessage.Url);
|
var requestUri = new Uri(requestMessage.Url);
|
||||||
@@ -369,19 +348,41 @@ namespace WireMock.ResponseBuilders
|
|||||||
return await HttpClientHelper.SendAsync(_httpClientForProxy, requestMessage, proxyUriWithRequestPathAndQuery.AbsoluteUri);
|
return await HttpClientHelper.SendAsync(_httpClientForProxy, requestMessage, proxyUriWithRequestPathAndQuery.AbsoluteUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResponseMessage responseMessage;
|
||||||
|
if (Callback == null)
|
||||||
|
{
|
||||||
|
responseMessage = ResponseMessage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responseMessage = Callback(requestMessage);
|
||||||
|
|
||||||
|
if (!WithCallbackUsed)
|
||||||
|
{
|
||||||
|
// Copy StatusCode from ResponseMessage
|
||||||
|
responseMessage.StatusCode = ResponseMessage.StatusCode;
|
||||||
|
|
||||||
|
// Copy Headers from ResponseMessage (if defined)
|
||||||
|
if (ResponseMessage.Headers != null)
|
||||||
|
{
|
||||||
|
responseMessage.Headers = ResponseMessage.Headers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (UseTransformer)
|
if (UseTransformer)
|
||||||
{
|
{
|
||||||
var factory = new HandlebarsContextFactory(settings.FileSystemHandler, settings.HandlebarsRegistrationCallback);
|
var factory = new HandlebarsContextFactory(settings.FileSystemHandler, settings.HandlebarsRegistrationCallback);
|
||||||
var responseMessageTransformer = new ResponseMessageTransformer(factory);
|
var responseMessageTransformer = new ResponseMessageTransformer(factory);
|
||||||
return responseMessageTransformer.Transform(requestMessage, ResponseMessage, UseTransformerForBodyAsFile);
|
return responseMessageTransformer.Transform(requestMessage, responseMessage, UseTransformerForBodyAsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UseTransformer && ResponseMessage.BodyData?.BodyAsFileIsCached == true)
|
if (!UseTransformer && ResponseMessage.BodyData?.BodyAsFileIsCached == true)
|
||||||
{
|
{
|
||||||
ResponseMessage.BodyData.BodyAsBytes = settings.FileSystemHandler.ReadResponseBodyAsFile(ResponseMessage.BodyData.BodyAsFile);
|
ResponseMessage.BodyData.BodyAsBytes = settings.FileSystemHandler.ReadResponseBodyAsFile(responseMessage.BodyData.BodyAsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseMessage;
|
return responseMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ namespace WireMock.Util
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case JTokenType.Integer:
|
case JTokenType.Integer:
|
||||||
castText = $"int({path})";
|
castText = $"long({path})";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JTokenType.Null:
|
case JTokenType.Null:
|
||||||
|
|||||||
@@ -70,12 +70,13 @@ namespace WireMock.Net.Tests.Matchers
|
|||||||
// Assign
|
// Assign
|
||||||
var input = new JObject
|
var input = new JObject
|
||||||
{
|
{
|
||||||
{ "Id", new JValue(9) },
|
{ "IntegerId", new JValue(9) },
|
||||||
|
{ "LongId", new JValue(long.MaxValue) },
|
||||||
{ "Name", new JValue("Test") }
|
{ "Name", new JValue("Test") }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var matcher = new LinqMatcher("Id > 1 AND Name == \"Test\"");
|
var matcher = new LinqMatcher("IntegerId > 1 AND LongId > 1 && Name == \"Test\"");
|
||||||
double match = matcher.IsMatch(input);
|
double match = matcher.IsMatch(input);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NFluent;
|
using FluentAssertions;
|
||||||
using WireMock.Models;
|
using WireMock.Models;
|
||||||
using WireMock.ResponseBuilders;
|
using WireMock.ResponseBuilders;
|
||||||
using WireMock.Settings;
|
using WireMock.Settings;
|
||||||
@@ -17,15 +17,49 @@ namespace WireMock.Net.Tests.ResponseBuilders
|
|||||||
public async Task Response_WithCallback()
|
public async Task Response_WithCallback()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
var request = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1");
|
var requestMessage = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1");
|
||||||
var response = Response.Create().WithCallback(req => new ResponseMessage { BodyData = new BodyData { DetectedBodyType = BodyType.String, BodyAsString = req.Path + "Bar" }, StatusCode = 302 });
|
var response = Response.Create()
|
||||||
|
.WithCallback(request => new ResponseMessage
|
||||||
|
{
|
||||||
|
BodyData = new BodyData
|
||||||
|
{
|
||||||
|
DetectedBodyType = BodyType.String,
|
||||||
|
BodyAsString = request.Path + "Bar"
|
||||||
|
},
|
||||||
|
StatusCode = 302
|
||||||
|
});
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var responseMessage = await response.ProvideResponseAsync(request, _settings);
|
var responseMessage = await response.ProvideResponseAsync(requestMessage, _settings);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Check.That(responseMessage.BodyData.BodyAsString).IsEqualTo("/fooBar");
|
responseMessage.BodyData.BodyAsString.Should().Be("/fooBar");
|
||||||
Check.That(responseMessage.StatusCode).IsEqualTo(302);
|
responseMessage.StatusCode.Should().Be(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task Response_WithCallback_And_UseTransformer_Is_True()
|
||||||
|
{
|
||||||
|
// Assign
|
||||||
|
var requestMessage = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1");
|
||||||
|
var response = Response.Create()
|
||||||
|
.WithCallback(request => new ResponseMessage
|
||||||
|
{
|
||||||
|
BodyData = new BodyData
|
||||||
|
{
|
||||||
|
DetectedBodyType = BodyType.String,
|
||||||
|
BodyAsString = "{{request.Path}}Bar"
|
||||||
|
},
|
||||||
|
StatusCode = 302
|
||||||
|
})
|
||||||
|
.WithTransformer();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var responseMessage = await response.ProvideResponseAsync(requestMessage, _settings);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
responseMessage.BodyData.BodyAsString.Should().Be("/fooBar");
|
||||||
|
responseMessage.StatusCode.Should().Be(302);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ namespace WireMock.Net.Tests.Util
|
|||||||
{"Flt", new JValue(10.0f)},
|
{"Flt", new JValue(10.0f)},
|
||||||
{"Dbl", new JValue(Math.PI)},
|
{"Dbl", new JValue(Math.PI)},
|
||||||
{"Check", new JValue(true)},
|
{"Check", new JValue(true)},
|
||||||
{"Items", new JArray(new[] {new JValue(4), new JValue(8)})},
|
{"Items", new JArray(new[] { new JValue(4), new JValue(8) })},
|
||||||
{
|
{
|
||||||
"Child", new JObject
|
"Child", new JObject
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,8 @@ namespace WireMock.Net.Tests.Util
|
|||||||
{"TS", new JValue(TimeSpan.FromMilliseconds(999))}
|
{"TS", new JValue(TimeSpan.FromMilliseconds(999))}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{"Id", new JValue(9)},
|
{"I", new JValue(9)},
|
||||||
|
{"L", new JValue(long.MaxValue)},
|
||||||
{"Name", new JValue("Test")}
|
{"Name", new JValue("Test")}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -70,10 +71,10 @@ namespace WireMock.Net.Tests.Util
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var queryable = new[] { j }.AsQueryable().Select(line);
|
var queryable = new[] { j }.AsQueryable().Select(line);
|
||||||
bool result = queryable.Any("Id > 4");
|
bool result = queryable.Any("I > 1 && L > 1");
|
||||||
Check.That(result).IsTrue();
|
Check.That(result).IsTrue();
|
||||||
|
|
||||||
Check.That(line).IsEqualTo("new (Uri(U) as U, null as N, Guid(G) as G, double(Flt) as Flt, double(Dbl) as Dbl, bool(Check) as Check, (new [] { int(Items[0]), int(Items[1])}) as Items, new (int(Child.ChildId) as ChildId, DateTime(Child.ChildDateTime) as ChildDateTime, TimeSpan(Child.TS) as TS) as Child, int(Id) as Id, string(Name) as Name)");
|
Check.That(line).IsEqualTo("new (Uri(U) as U, null as N, Guid(G) as G, double(Flt) as Flt, double(Dbl) as Dbl, bool(Check) as Check, (new [] { long(Items[0]), long(Items[1])}) as Items, new (long(Child.ChildId) as ChildId, DateTime(Child.ChildDateTime) as ChildDateTime, TimeSpan(Child.TS) as TS) as Child, long(I) as I, long(L) as L, string(Name) as Name)");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -82,7 +83,7 @@ namespace WireMock.Net.Tests.Util
|
|||||||
// Assign
|
// Assign
|
||||||
var j = new JObject
|
var j = new JObject
|
||||||
{
|
{
|
||||||
{"B", new JValue(new byte[] {48, 49})}
|
{ "B", new JValue(new byte[] {48, 49}) }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act and Assert
|
// Act and Assert
|
||||||
|
|||||||
Reference in New Issue
Block a user