fix code broken after net5.0 upgrade

This commit is contained in:
TomPallister 2020-11-20 12:10:46 +00:00
parent 1c6bfc3314
commit a9eec31aaf

View File

@ -24,8 +24,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void should_transform_upstream_header() public void should_transform_upstream_header()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -65,8 +65,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void should_transform_downstream_header() public void should_transform_downstream_header()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -105,8 +105,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void should_fix_issue_190() public void should_fix_issue_190()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -149,8 +149,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void should_fix_issue_205() public void should_fix_issue_205()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -193,8 +193,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void should_fix_issue_417() public void should_fix_issue_417()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -241,8 +241,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void request_should_reuse_cookies_with_cookie_container() public void request_should_reuse_cookies_with_cookie_container()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -284,8 +284,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void request_should_have_own_cookies_no_cookie_container() public void request_should_have_own_cookies_no_cookie_container()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -327,8 +327,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void issue_474_should_not_put_spaces_in_header() public void issue_474_should_not_put_spaces_in_header()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -364,8 +364,8 @@ namespace Ocelot.AcceptanceTests
[Fact] [Fact]
public void issue_474_should_put_spaces_in_header() public void issue_474_should_put_spaces_in_header()
{ {
var port = RandomPortFinder.GetRandomPort(); var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration var configuration = new FileConfiguration
{ {
@ -413,9 +413,18 @@ namespace Ocelot.AcceptanceTests
return Task.CompletedTask; return Task.CompletedTask;
} }
if (context.Request.Cookies.TryGetValue("test", out var cookieValue) || context.Request.Headers.TryGetValue("Set-Cookie", out var headerValue)) if (context.Request.Cookies.TryGetValue("test", out var cookieValue))
{ {
if (cookieValue == "0" || headerValue == "test=1; path=/") if (cookieValue == "0")
{
context.Response.StatusCode = statusCode;
return Task.CompletedTask;
}
}
if (context.Request.Headers.TryGetValue("Set-Cookie", out var headerValue))
{
if (headerValue == "test=1; path=/")
{ {
context.Response.StatusCode = statusCode; context.Response.StatusCode = statusCode;
return Task.CompletedTask; return Task.CompletedTask;