This commit is contained in:
Stef Heyenrath
2022-11-30 15:23:36 +01:00
parent 0a4aca9ae9
commit c8ad9f49e4
2 changed files with 48 additions and 1 deletions

View File

@@ -68,7 +68,7 @@ namespace WireMock.Owin.Mappers
body = await BodyParser.ParseAsync(bodyParserSettings).ConfigureAwait(false);
}
return new RequestMessage(urlDetails, method, clientIP, body, headers, cookies) { DateTime = DateTime.UtcNow };
return new RequestMessage(options, urlDetails, method, clientIP, body, headers, cookies) { DateTime = DateTime.UtcNow };
}
private static (UrlDetails UrlDetails, string ClientIP) ParseRequest(IRequest request)

View File

@@ -0,0 +1,47 @@
using System;
using System.Net;
using System.Threading.Tasks;
using FluentAssertions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;
using WireMock.Settings;
using WireMock.Types;
using Xunit;
namespace WireMock.Net.Tests;
public partial class WireMockServerTests
{
[Fact]
public async Task WireMockServer_WithParam_QueryParameterMultipleValueSupport_NoComma_Should_Ignore_Comma()
{
// Arrange
var queryValue = "SELECT id, value FROM table WHERE id = 1";
var settings = new WireMockServerSettings
{
QueryParameterMultipleValueSupport = QueryParameterMultipleValueSupport.NoComma
};
var server = WireMockServer.Start(settings);
server.Given(
Request.Create()
.UsingGet()
.WithPath("/foo")
.WithParam("query", queryValue)
)
.RespondWith(
Response.Create().WithStatusCode(200)
);
// Act
var requestUri = new Uri($"http://localhost:{server.Port}/foo?query={queryValue}");
var response = await server.CreateClient().GetAsync(requestUri).ConfigureAwait(false);
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
server.Stop();
}
}