This commit is contained in:
TomPallister 2020-02-21 16:53:03 +00:00
parent ec8a5b6ddf
commit ede5650a3c
2 changed files with 45 additions and 1 deletions

View File

@ -25,6 +25,7 @@ Here is an example ReRoute configuration, You don't need to set all of these thi
"Get" "Get"
], ],
"DownstreamHttpMethod": "", "DownstreamHttpMethod": "",
"DownstreamHttpVersion": "",
"AddHeadersToRequest": {}, "AddHeadersToRequest": {},
"AddClaimsToRequest": {}, "AddClaimsToRequest": {},
"RouteClaimsRequirement": {}, "RouteClaimsRequirement": {},
@ -279,3 +280,8 @@ Registering a callback
_callbackHolder.Dispose(); _callbackHolder.Dispose();
} }
} }
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".

View File

@ -22,6 +22,44 @@ namespace Ocelot.AcceptanceTests
_steps = new Steps(); _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<FileReRoute>
{
new FileReRoute
{
DownstreamPathTemplate = "/{url}",
DownstreamScheme = "https",
UpstreamPathTemplate = "/{url}",
UpstreamHttpMethod = new List<string> { "Get" },
DownstreamHostAndPorts = new List<FileHostAndPort>
{
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] [Fact]
public void should_return_response_200_when_using_http_one_point_one() public void should_return_response_200_when_using_http_one_point_one()
{ {