mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 10:12:51 +08:00
tests for downstream http version validation
This commit is contained in:
parent
f2f583a88c
commit
42a1395a84
@ -305,6 +305,71 @@
|
|||||||
.BDDfy();
|
.BDDfy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("1.0")]
|
||||||
|
[InlineData("1.1")]
|
||||||
|
[InlineData("2.0")]
|
||||||
|
[InlineData("1,0")]
|
||||||
|
[InlineData("1,1")]
|
||||||
|
[InlineData("2,0")]
|
||||||
|
[InlineData("1")]
|
||||||
|
[InlineData("2")]
|
||||||
|
[InlineData("")]
|
||||||
|
[InlineData(null)]
|
||||||
|
public void should_be_valid_re_route_using_downstream_http_version(string version)
|
||||||
|
{
|
||||||
|
var fileReRoute = new FileReRoute
|
||||||
|
{
|
||||||
|
DownstreamPathTemplate = "/test",
|
||||||
|
UpstreamPathTemplate = "/test",
|
||||||
|
DownstreamHostAndPorts = new List<FileHostAndPort>
|
||||||
|
{
|
||||||
|
new FileHostAndPort
|
||||||
|
{
|
||||||
|
Host = "localhost",
|
||||||
|
Port = 5000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
DownstreamHttpVersion = version,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.Given(_ => GivenThe(fileReRoute))
|
||||||
|
.When(_ => WhenIValidate())
|
||||||
|
.Then(_ => ThenTheResultIsValid())
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("retg1.1")]
|
||||||
|
[InlineData("re2.0")]
|
||||||
|
[InlineData("1,0a")]
|
||||||
|
[InlineData("a1,1")]
|
||||||
|
[InlineData("12,0")]
|
||||||
|
[InlineData("asdf")]
|
||||||
|
public void should_be_invalid_re_route_using_downstream_http_version(string version)
|
||||||
|
{
|
||||||
|
var fileReRoute = new FileReRoute
|
||||||
|
{
|
||||||
|
DownstreamPathTemplate = "/test",
|
||||||
|
UpstreamPathTemplate = "/test",
|
||||||
|
DownstreamHostAndPorts = new List<FileHostAndPort>
|
||||||
|
{
|
||||||
|
new FileHostAndPort
|
||||||
|
{
|
||||||
|
Host = "localhost",
|
||||||
|
Port = 5000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
DownstreamHttpVersion = version,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.Given(_ => GivenThe(fileReRoute))
|
||||||
|
.When(_ => WhenIValidate())
|
||||||
|
.Then(_ => ThenTheResultIsInvalid())
|
||||||
|
.And(_ => ThenTheErrorsContains("'Downstream Http Version' is not in the correct format."))
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
private void GivenAnAuthProvider(string key)
|
private void GivenAnAuthProvider(string key)
|
||||||
{
|
{
|
||||||
var schemes = new List<AuthenticationScheme>
|
var schemes = new List<AuthenticationScheme>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user