From c7e86361d73d1457d7825d5f57a6abe4cc26fd8b Mon Sep 17 00:00:00 2001 From: Edgar Espina Date: Sun, 22 Oct 2017 15:41:09 -0300 Subject: [PATCH] revert: Surprising param encoding #900 --- jooby/src/main/java/org/jooby/Router.java | 5 ++--- .../src/test/java/org/jooby/PathVarMustBeDecodedFeature.java | 2 +- .../src/test/java/org/jooby/issues/Issue900.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/jooby/src/main/java/org/jooby/Router.java b/jooby/src/main/java/org/jooby/Router.java index 8623f82e60..4a16b34080 100644 --- a/jooby/src/main/java/org/jooby/Router.java +++ b/jooby/src/main/java/org/jooby/Router.java @@ -230,13 +230,12 @@ public interface Router { /** - * Decode a path by delegating to {@link URLDecoder#decode(String, String)}. This function keeps - * the + character. + * Decode a path by delegating to {@link URLDecoder#decode(String, String)}. * * @param path Path to decoded. */ static String decode(String path) { - return Try.apply(() -> URLDecoder.decode(path.replace("+", "%2b"), "UTF-8")).get(); + return Try.apply(() -> URLDecoder.decode(path, "UTF-8")).get(); } /** diff --git a/modules/coverage-report/src/test/java/org/jooby/PathVarMustBeDecodedFeature.java b/modules/coverage-report/src/test/java/org/jooby/PathVarMustBeDecodedFeature.java index 18200c8cc0..8d2de51d18 100644 --- a/modules/coverage-report/src/test/java/org/jooby/PathVarMustBeDecodedFeature.java +++ b/modules/coverage-report/src/test/java/org/jooby/PathVarMustBeDecodedFeature.java @@ -17,6 +17,6 @@ public void pathVarShouldBeDecoded() throws Exception { request() .get("/plus+plus") - .expect("plus+plus"); + .expect("plus plus"); } } diff --git a/modules/coverage-report/src/test/java/org/jooby/issues/Issue900.java b/modules/coverage-report/src/test/java/org/jooby/issues/Issue900.java index 25d394255e..497e9675de 100644 --- a/modules/coverage-report/src/test/java/org/jooby/issues/Issue900.java +++ b/modules/coverage-report/src/test/java/org/jooby/issues/Issue900.java @@ -18,7 +18,7 @@ public void shouldNotEncodingPlusSign() throws Exception { int ch = '+'; System.out.println(Integer.toHexString(ch)); request().get("/900/a+b") - .expect("a+b"); + .expect("a b"); } }