Christopher Jackson created KNOX-614:
----------------------------------------

             Summary: Incorrect parsing when using #
                 Key: KNOX-614
                 URL: https://issues.apache.org/jira/browse/KNOX-614
             Project: Apache Knox
          Issue Type: Bug
          Components: Server
    Affects Versions: 0.6.0
            Reporter: Christopher Jackson


The following test case does not produce the expected output. 

{code}
java.lang.AssertionError: 
Expected: is 
"https://gateway-host:9443/gateway/default/foo/context/?user.name=admin#/login";
got: 
"https://gateway-host:9443/gateway/default/foo/context/?fragment=/login#/login";
{code}

{code}
@Test
        public void testRedirectHeaderRewrite() throws Exception {
                URI inputUri, outputUri;
                Matcher<Void> matcher;
                Matcher<Void>.Match match;
                Template input, pattern, template;
                Evaluator evaluator;

                inputUri = new 
URI("https://internal-host:9443/context/?user.name=admin#/login";);

                input = Parser.parse( inputUri.toString() );
                pattern = Parser.parse( 
"*://*:*/{contextRoot}/?{**}#{fragment}" );
                template = Parser.parse( 
"{$gateway.url}/foo/{contextRoot}/?{**}#{fragment}" );

                matcher = new Matcher<Void>();
                matcher.add( pattern, null );
                match = matcher.match( input );

                evaluator = new Evaluator() {
                    @Override
                    public List<String> evaluate( String function, List<String> 
parameters ) {
                      return Arrays.asList( 
"https://gateway-host:9443/gateway/default"; );
                    }
                  };

                
                outputUri = Expander.expand( template, match.getParams(), 
evaluator );
                assertNotNull(outputUri.toString());
                assertThat(
                                outputUri.toString(),
                                is( 
"https://gateway-host:9443/gateway/default/foo/context/?user.name=admin#/login"; 
) );
        }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to