Cookie proxying and auto redirect configuration #128

HttpHandlerOptions are added to ReRoute configuration and passed down to HttpClientHttpRequester as Request properties.
This commit is contained in:
Oleksandr Yershov
2017-09-28 09:41:13 +03:00
parent 41e9dfac94
commit a8b56a63c2
21 changed files with 269 additions and 28 deletions

View File

@ -15,8 +15,9 @@
using TestStack.BDDfy;
using Xunit;
using Ocelot.Requester.QoS;
using Microsoft.AspNetCore.Builder;
using Ocelot.Configuration;
using Microsoft.AspNetCore.Builder;
public class HttpRequestBuilderMiddlewareTests : ServerHostedMiddlewareTest
{
private readonly Mock<IRequestCreator> _requestBuilder;
@ -50,12 +51,13 @@
new ReRouteBuilder()
.WithRequestIdKey("LSRequestId")
.WithUpstreamHttpMethod(new List<string> { "Get" })
.WithHttpHandlerOptions(new HttpHandlerOptions(true, true))
.Build());
this.Given(x => x.GivenTheDownStreamUrlIs("any old string"))
.And(x => x.GivenTheQosProviderHouseReturns(new OkResponse<IQoSProvider>(new NoQoSProvider())))
.And(x => x.GivenTheDownStreamRouteIs(downstreamRoute))
.And(x => x.GivenTheRequestBuilderReturns(new Ocelot.Request.Request(new HttpRequestMessage(), true, new NoQoSProvider())))
.And(x => x.GivenTheRequestBuilderReturns(new Ocelot.Request.Request(new HttpRequestMessage(), true, new NoQoSProvider(), false, false)))
.When(x => x.WhenICallTheMiddleware())
.Then(x => x.ThenTheScopedDataRepositoryIsCalledCorrectly())
.BDDfy();
@ -103,7 +105,11 @@
_request = new OkResponse<Ocelot.Request.Request>(request);
_requestBuilder
.Setup(x => x.Build(It.IsAny<HttpRequestMessage>(), It.IsAny<bool>(), It.IsAny<IQoSProvider>()))
.Setup(x => x.Build(It.IsAny<HttpRequestMessage>(),
It.IsAny<bool>(),
It.IsAny<IQoSProvider>(),
It.IsAny<bool>(),
It.IsAny<bool>()))
.ReturnsAsync(_request);
}