@Test public void testOldRequestSyntax() throws Exception { ProxyServletRequest req = setupMockRequest("http://localhost/gadgets/proxy?url=" + URL); assertFalse(req.isUsingChainedSyntax()); assertEquals(URL, req.getParameter("url")); verify(); }
@Test public void testChainedSyntaxWithParametersDontDecode() throws Exception { ProxyServletRequest req = setupMockRequest("http://*****:*****@127.0.0.1:80/g/proxy/a=b%20+c&url=u/http://r/p%3Fa+e"); assertTrue(req.isUsingChainedSyntax()); assertEquals("http://r/p%3Fa+e", req.getParameter("url")); assertEquals("b c", req.getParameter("a")); verify(); }
@Test public void testChainedSyntaxWithOneParameter() throws Exception { ProxyServletRequest req = setupMockRequest("http://localhost/gadgets/proxy/nocache=1/http://remote/proxy?nocache=0"); assertTrue(req.isUsingChainedSyntax()); assertEquals("http://remote/proxy?nocache=0", req.getParameter("url")); assertEquals("1", req.getParameter("nocache")); verify(); }
@Test public void testChainedSyntaxWithNoParameters() throws Exception { ProxyServletRequest req = setupMockRequest("http://localhost/gadgets/proxy//http://remote/proxy?query=foo"); assertTrue(req.isUsingChainedSyntax()); assertEquals("http://remote/proxy?query=foo", req.getParameter("url")); assertNull(req.getParameter("query")); verify(); }