diff --git a/docs/features/configuration.rst b/docs/features/configuration.rst index f9cb7841..ebd82203 100644 --- a/docs/features/configuration.rst +++ b/docs/features/configuration.rst @@ -25,6 +25,7 @@ Here is an example ReRoute configuration, You don't need to set all of these thi "Get" ], "DownstreamHttpMethod": "", + "DownstreamHttpVersion": "", "AddHeadersToRequest": {}, "AddClaimsToRequest": {}, "RouteClaimsRequirement": {}, @@ -278,4 +279,9 @@ Registering a callback { _callbackHolder.Dispose(); } - } \ No newline at end of file + } + +DownstreamHttpVersion +--------------------- + +Ocelot allows you to choose the HTTP version it will use to make the proxy request. It can be set as "1.0", "1.1" or "2.0". \ No newline at end of file diff --git a/test/Ocelot.AcceptanceTests/HttpTests.cs b/test/Ocelot.AcceptanceTests/HttpTests.cs index 89ab12f4..b63ad4bb 100644 --- a/test/Ocelot.AcceptanceTests/HttpTests.cs +++ b/test/Ocelot.AcceptanceTests/HttpTests.cs @@ -22,6 +22,44 @@ namespace Ocelot.AcceptanceTests _steps = new Steps(); } + [Fact] + public void should_return_response_200_when_using_http_one() + { + const int port = 53219; + + var configuration = new FileConfiguration + { + ReRoutes = new List + { + new FileReRoute + { + DownstreamPathTemplate = "/{url}", + DownstreamScheme = "https", + UpstreamPathTemplate = "/{url}", + UpstreamHttpMethod = new List { "Get" }, + DownstreamHostAndPorts = new List + { + new FileHostAndPort + { + Host = "localhost", + Port = port, + }, + }, + DownstreamHttpMethod = "POST", + DownstreamHttpVersion = "1.0", + DangerousAcceptAnyServerCertificateValidator = true + }, + }, + }; + + this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}/", "/", port, HttpProtocols.Http1)) + .And(x => _steps.GivenThereIsAConfiguration(configuration)) + .And(x => _steps.GivenOcelotIsRunning()) + .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) + .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .BDDfy(); + } + [Fact] public void should_return_response_200_when_using_http_one_point_one() {