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

Method urlEncoding

src/test/java/org/htmlunit/WebClientTest.java:1546–1552  ·  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

1544 * @throws Exception if an error occurs
1545 */
1546 @Test
1547 public void urlEncoding() throws Exception {
1548 final URL url = new URL("http://host/x+y\u00E9/a\u00E9 b?c \u00E9 d");
1549 final HtmlPage page = loadPage(BrowserVersion.FIREFOX, DOCTYPE_HTML + "<html></html>", new ArrayList<>(), url);
1550 final WebRequest wrs = page.getWebResponse().getWebRequest();
1551 assertEquals("http://host/x+y%C3%A9/a%C3%A9%20b?c%20%C3%A9%20d", wrs.getUrl());
1552 }
1553
1554 /**
1555 * Verifies that URLs are automatically encoded before being sent to the server, like

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