Skip to content

Commit

Permalink
HttpTest encoded to Ascii
Browse files Browse the repository at this point in the history
Also, added euro sign param check to Http client redirect tests

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
  • Loading branch information
tsegismont committed Jan 31, 2018
1 parent dccb313 commit 88e2fcd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/test/java/io/vertx/test/core/HttpTest.java
Expand Up @@ -644,7 +644,7 @@ private void testURIAndPath(String uri, String path) {


@Test @Test
public void testParamUmlauteDecoding() throws UnsupportedEncodingException { public void testParamUmlauteDecoding() throws UnsupportedEncodingException {
testParamDecoding("äüö"); testParamDecoding("\u00e4\u00fc\u00f6");
} }


@Test @Test
Expand All @@ -669,7 +669,7 @@ public void testParamNormalDecoding() throws UnsupportedEncodingException {


@Test @Test
public void testParamAltogetherDecoding() throws UnsupportedEncodingException { public void testParamAltogetherDecoding() throws UnsupportedEncodingException {
testParamDecoding("äüö+% hello"); testParamDecoding("\u00e4\u00fc\u00f6+% hello");
} }


private void testParamDecoding(String value) throws UnsupportedEncodingException { private void testParamDecoding(String value) throws UnsupportedEncodingException {
Expand Down Expand Up @@ -3814,8 +3814,8 @@ class MockResp implements HttpClientResponse {
} }


@Test @Test
public void testFollowRedirectEncodedUrl() throws Exception { public void testFollowRedirectEncodedParams() throws Exception {
String value1 = "한글", value2 = "A B+C"; String value1 = "\ud55c\uae00", value2 = "A B+C", value3 = "123 \u20ac";
server.requestHandler(req -> { server.requestHandler(req -> {
switch (req.path()) { switch (req.path()) {
case "/first/call/from/client": case "/first/call/from/client":
Expand All @@ -3825,7 +3825,8 @@ public void testFollowRedirectEncodedUrl() throws Exception {
.append(req.scheme()).append("://").append(DEFAULT_HTTP_HOST).append(':').append(DEFAULT_HTTP_PORT) .append(req.scheme()).append("://").append(DEFAULT_HTTP_HOST).append(':').append(DEFAULT_HTTP_PORT)
.append("/redirected/from/client?") .append("/redirected/from/client?")
.append("encoded1=").append(URLEncoder.encode(value1, "UTF-8")).append('&') .append("encoded1=").append(URLEncoder.encode(value1, "UTF-8")).append('&')
.append("encoded2=").append(URLEncoder.encode(value2, "UTF-8")); .append("encoded2=").append(URLEncoder.encode(value2, "UTF-8")).append('&')
.append("encoded3=").append(URLEncoder.encode(value3, "UTF-8"));
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
fail(e); fail(e);
} }
Expand All @@ -3837,6 +3838,7 @@ public void testFollowRedirectEncodedUrl() throws Exception {
case "/redirected/from/client": case "/redirected/from/client":
assertEquals(value1, req.params().get("encoded1")); assertEquals(value1, req.params().get("encoded1"));
assertEquals(value2, req.params().get("encoded2")); assertEquals(value2, req.params().get("encoded2"));
assertEquals(value3, req.params().get("encoded3"));
req.response().end(); req.response().end();
break; break;
default: default:
Expand Down

0 comments on commit 88e2fcd

Please sign in to comment.