diff --git a/src/Core/Extensions/Basic.cs b/src/Core/Extensions/Basic.cs index 4e98f88..b16d1b6 100644 --- a/src/Core/Extensions/Basic.cs +++ b/src/Core/Extensions/Basic.cs @@ -240,7 +240,7 @@ internal static EndpointComputerToValueTask GetRunProxyComputer(EndpointComputer return async (context, args) => { var endpoint = await GetEndpointFromComputerAsync(context, endpointComputer).ConfigureAwait(false); - return $"{endpoint}{context.Request.Path}"; + return $"{endpoint}{context.Request.Path}{context.Request.QueryString}"; }; } diff --git a/src/Test/Extensions.cs b/src/Test/Extensions.cs index 606b86d..79ca63b 100644 --- a/src/Test/Extensions.cs +++ b/src/Test/Extensions.cs @@ -6,6 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Extensions; namespace AspNetCore.Proxy.Tests { @@ -63,7 +64,8 @@ internal static async Task SocketBoomerang(this HttpContext context) internal static async Task HttpBoomerang(this HttpContext context) { var message = await new StreamReader(context.Request.Body).ReadToEndAsync(); - await context.Response.WriteAsync($"[{message}]"); + var uri = context.Request.GetDisplayUrl(); + await context.Response.WriteAsync($"({uri})[{message}]"); } } } \ No newline at end of file diff --git a/src/Test/RunProxy/RunProxyIntegrationTests.cs b/src/Test/RunProxy/RunProxyIntegrationTests.cs index 9404d2d..3b4af1a 100644 --- a/src/Test/RunProxy/RunProxyIntegrationTests.cs +++ b/src/Test/RunProxy/RunProxyIntegrationTests.cs @@ -70,7 +70,7 @@ public async Task CanDoWebSockets() // HTTP test. var response = await _httpClient.PostAsync("http://localhost:5003/at/some/path", new StringContent(send1)); - Assert.Equal(expected1, await response.Content.ReadAsStringAsync()); + Assert.EndsWith(expected1, await response.Content.ReadAsStringAsync()); } [Fact] @@ -80,6 +80,16 @@ public async Task CanDoSimpleServer() var expected1 = $"[{send1}]"; var response = await _httpClient.PostAsync("http://localhost:5007/at/some/other/path", new StringContent(send1)); + Assert.EndsWith(expected1, await response.Content.ReadAsStringAsync()); + } + + [Fact] + public async Task CanAppendQueryParameters() + { + var send1 = "TESTWITHQUERY"; + var expected1 = $"(http://localhost:5004/at/some/other/path?with=query¶meters=true)[{send1}]"; + + var response = await _httpClient.PostAsync("http://localhost:5007/at/some/other/path?with=query¶meters=true", new StringContent(send1)); Assert.Equal(expected1, await response.Content.ReadAsStringAsync()); }