Moved common middleare test setup into a base class

This commit is contained in:
Philip Wood
2017-07-18 09:28:32 +01:00
parent b0c12431d6
commit 8042bbab2c
20 changed files with 787 additions and 916 deletions

View File

@ -62,14 +62,6 @@ namespace Ocelot.Responder
}
}
private static void AddHeaderIfDoesntExist(HttpContext context, KeyValuePair<string, IEnumerable<string>> httpResponseHeader)
{
if (!context.Response.Headers.ContainsKey(httpResponseHeader.Key))
{
context.Response.Headers.Add(httpResponseHeader.Key, new StringValues(httpResponseHeader.Value.ToArray()));
}
}
public void SetErrorResponseOnContext(HttpContext context, int statusCode)
{
context.Response.OnStarting(x =>
@ -78,5 +70,13 @@ namespace Ocelot.Responder
return Task.CompletedTask;
}, context);
}
private static void AddHeaderIfDoesntExist(HttpContext context, KeyValuePair<string, IEnumerable<string>> httpResponseHeader)
{
if (!context.Response.Headers.ContainsKey(httpResponseHeader.Key))
{
context.Response.Headers.Add(httpResponseHeader.Key, new StringValues(httpResponseHeader.Value.ToArray()));
}
}
}
}