Exemple #1
0
        public void should_transform_upstream_header()
        {
            var configuration = new FileConfiguration
            {
                ReRoutes = new List <FileReRoute>
                {
                    new FileReRoute
                    {
                        DownstreamPathTemplate = "/",
                        DownstreamScheme       = "http",
                        DownstreamHost         = "localhost",
                        DownstreamPort         = 51879,
                        UpstreamPathTemplate   = "/",
                        UpstreamHttpMethod     = new List <string> {
                            "Get"
                        },
                        UpstreamHeaderTransform = new Dictionary <string, string>
                        {
                            { "Laz", "D, GP" }
                        }
                    }
                }
            };

            this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51879", "/", 200, "Laz"))
            .And(x => _steps.GivenThereIsAConfiguration(configuration))
            .And(x => _steps.GivenOcelotIsRunning())
            .And(x => _steps.GivenIAddAHeader("Laz", "D"))
            .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
            .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
            .And(x => _steps.ThenTheResponseBodyShouldBe("GP"))
            .BDDfy();
        }