示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSetTheRequestUriToTheSameValueAsTheXForwardHostHeader()
        public virtual void ShouldSetTheRequestUriToTheSameValueAsTheXForwardHostHeader()
        {
            // given
            const string xForwardHostAndPort = "jimwebber.org:1234";

            XForwardFilter filter = new XForwardFilter();

            InBoundHeaders headers = new InBoundHeaders();

            headers.add(X_FORWARD_HOST_HEADER_KEY, xForwardHostAndPort);

            ContainerRequest request = new ContainerRequest(WEB_APPLICATION, "GET", URI.create("http://iansrobinson.com"), URI.create("http://iansrobinson.com/foo/bar"), headers, INPUT_STREAM);

            // when
            ContainerRequest result = filter.Filter(request);

            // then
            assertTrue(result.RequestUri.ToString().StartsWith("http://" + xForwardHostAndPort, StringComparison.Ordinal));
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSetTheRequestUriToTheSameProtocolAsTheXForwardProtoHeader()
        public virtual void ShouldSetTheRequestUriToTheSameProtocolAsTheXForwardProtoHeader()
        {
            // given
            const string theProtocol = "https";

            XForwardFilter filter = new XForwardFilter();

            InBoundHeaders headers = new InBoundHeaders();

            headers.add(X_FORWARD_PROTO_HEADER_KEY, theProtocol);

            ContainerRequest request = new ContainerRequest(WEB_APPLICATION, "GET", URI.create("http://jimwebber.org:1234"), URI.create("http://jimwebber.org:1234/foo/bar"), headers, INPUT_STREAM);

            // when
            ContainerRequest result = filter.Filter(request);

            // then
            assertThat(result.BaseUri.Scheme, containsString(theProtocol));
        }