MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / urlEncoding2

Method urlEncoding2

src/test/java/org/htmlunit/WebClientTest.java:1559–1566  ·  view source on GitHub ↗

Verifies that URLs are automatically encoded before being sent to the server, like regular browsers do (verified by sniffing HTTP headers). @throws Exception if an error occurs

()

Source from the content-addressed store, hash-verified

1557 * @throws Exception if an error occurs
1558 */
1559 @Test
1560 public void urlEncoding2() throws Exception {
1561 final URL url = new URL("http://host/x+y\u00E9/a\u00E9 b?c \u00E9 d");
1562 final HtmlPage page = loadPage(BrowserVersion.BEST_SUPPORTED,
1563 DOCTYPE_HTML + "<html></html>", new ArrayList<>(), url);
1564 final WebRequest wrs = page.getWebResponse().getWebRequest();
1565 assertEquals("http://host/x+y%C3%A9/a%C3%A9%20b?c%20%C3%A9%20d", wrs.getUrl());
1566 }
1567
1568 /**
1569 * Test that '+' is not encoded in URLs.

Callers

nothing calls this directly

Calls 5

getUrlMethod · 0.95
getWebResponseMethod · 0.65
loadPageMethod · 0.45
getWebRequestMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected