mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 12:10:50 +08:00 
			
		
		
		
	Feature/expose http handlers (#224)
* temp commit * trying to work out how to expose the http handlers in a decent way.. * pissing about at lunch * changed to func so you can instanciate object or new it up each time * docs for dele handlers * upgraded to sdk 2.1.4 * some validation for consul services
This commit is contained in:
		@@ -58,7 +58,7 @@
 | 
			
		||||
            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(), false, false,false)))
 | 
			
		||||
                .And(x => x.GivenTheRequestBuilderReturns(new Ocelot.Request.Request(new HttpRequestMessage(), true, new NoQoSProvider(), false, false, "", false)))
 | 
			
		||||
                .When(x => x.WhenICallTheMiddleware())
 | 
			
		||||
                .Then(x => x.ThenTheScopedDataRepositoryIsCalledCorrectly())
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -78,7 +78,7 @@
 | 
			
		||||
            this.Given(x => x.GivenTheDownStreamUrlIs("any old string"))
 | 
			
		||||
                .And(x => x.GivenTheQosProviderHouseReturns(new ErrorResponse<IQoSProvider>(It.IsAny<Error>())))
 | 
			
		||||
                .And(x => x.GivenTheDownStreamRouteIs(downstreamRoute))
 | 
			
		||||
                .And(x => x.GivenTheRequestBuilderReturns(new Ocelot.Request.Request(new HttpRequestMessage(), true, new NoQoSProvider(), false, false, false)))
 | 
			
		||||
                .And(x => x.GivenTheRequestBuilderReturns(new Ocelot.Request.Request(new HttpRequestMessage(), true, new NoQoSProvider(), false, false, "", false)))
 | 
			
		||||
                .When(x => x.WhenICallTheMiddleware())
 | 
			
		||||
                .Then(x => x.ThenTheScopedDataRepositoryQosProviderError())
 | 
			
		||||
                .BDDfy();
 | 
			
		||||
@@ -132,8 +132,8 @@
 | 
			
		||||
                                    It.IsAny<IQoSProvider>(),
 | 
			
		||||
                                    It.IsAny<bool>(),
 | 
			
		||||
                                    It.IsAny<bool>(),
 | 
			
		||||
                                    It.IsAny<bool>()
 | 
			
		||||
                                    ))
 | 
			
		||||
                                    It.IsAny<string>(),
 | 
			
		||||
                                    It.IsAny<bool>()))
 | 
			
		||||
                .ReturnsAsync(_request);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
namespace Ocelot.UnitTests.Request
 | 
			
		||||
namespace Ocelot.UnitTests.Request
 | 
			
		||||
{
 | 
			
		||||
    using System.Net.Http;
 | 
			
		||||
 | 
			
		||||
@@ -17,9 +17,9 @@
 | 
			
		||||
        private readonly HttpRequestMessage _requestMessage;
 | 
			
		||||
        private readonly bool _useCookieContainer;
 | 
			
		||||
        private readonly bool _allowAutoRedirect;
 | 
			
		||||
        private readonly bool _useTracing;
 | 
			
		||||
 | 
			
		||||
        private Response<Ocelot.Request.Request> _response;
 | 
			
		||||
        private string _reRouteKey;
 | 
			
		||||
        private readonly bool _useTracing;
 | 
			
		||||
 | 
			
		||||
        public HttpRequestCreatorTests()
 | 
			
		||||
        {
 | 
			
		||||
@@ -28,7 +28,7 @@
 | 
			
		||||
            _qoSProvider = new NoQoSProvider();
 | 
			
		||||
            _useCookieContainer = false;
 | 
			
		||||
            _allowAutoRedirect = false;
 | 
			
		||||
            _useTracing = false;
 | 
			
		||||
 | 
			
		||||
            _requestMessage = new HttpRequestMessage();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -48,7 +48,7 @@
 | 
			
		||||
        private void WhenIBuildARequest()
 | 
			
		||||
        {
 | 
			
		||||
            _response = _requestCreator.Build(_requestMessage,
 | 
			
		||||
                    _isQos, _qoSProvider, _useCookieContainer, _allowAutoRedirect, _useTracing)
 | 
			
		||||
                    _isQos, _qoSProvider, _useCookieContainer, _allowAutoRedirect, _reRouteKey, _useTracing)
 | 
			
		||||
                .GetAwaiter()
 | 
			
		||||
                .GetResult();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user