From c8ad9f49e4149304ae7742e4e149a8ed262b9b3b Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Wed, 30 Nov 2022 15:23:36 +0100 Subject: [PATCH] Fix --- .../Owin/Mappers/OwinRequestMapper.cs | 2 +- .../WireMockServerTests.WithParam.cs | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs diff --git a/src/WireMock.Net/Owin/Mappers/OwinRequestMapper.cs b/src/WireMock.Net/Owin/Mappers/OwinRequestMapper.cs index 29afe592..ccd00f43 100644 --- a/src/WireMock.Net/Owin/Mappers/OwinRequestMapper.cs +++ b/src/WireMock.Net/Owin/Mappers/OwinRequestMapper.cs @@ -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) diff --git a/test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs b/test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs new file mode 100644 index 00000000..bff02e83 --- /dev/null +++ b/test/WireMock.Net.Tests/WireMockServerTests.WithParam.cs @@ -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(); + } +} \ No newline at end of file