|
8 | 8 | import de.joshicodes.webapi.exceptions.UnknownContentTypeException; |
9 | 9 |
|
10 | 10 | import java.io.IOException; |
11 | | -import java.net.URLEncoder; |
| 11 | +import java.net.URLDecoder; |
12 | 12 | import java.nio.charset.StandardCharsets; |
13 | 13 | import java.util.HashMap; |
14 | 14 | import java.util.List; |
@@ -78,7 +78,7 @@ public HashMap<String, String> getPostParameters() throws MissingPostDataExcepti |
78 | 78 | if (param.contains("=")) { |
79 | 79 | String[] split = param.split("="); |
80 | 80 | if (split.length == 2) |
81 | | - parameters.put(split[0], URLEncoder.encode(split[1], StandardCharsets.UTF_8)); |
| 81 | + parameters.put(split[0], URLDecoder.decode(split[1], StandardCharsets.UTF_8)); |
82 | 82 | else if (split.length == 1) |
83 | 83 | parameters.put(split[0], null); |
84 | 84 | } else { |
@@ -116,7 +116,7 @@ public HashMap<String, String> getParameters() { |
116 | 116 | if (param.contains("=")) { |
117 | 117 | String[] split = param.split("="); |
118 | 118 | if (split.length == 2) |
119 | | - parameters.put(split[0], URLEncoder.encode(split[1], StandardCharsets.UTF_8)); |
| 119 | + parameters.put(split[0], URLDecoder.decode(split[1], StandardCharsets.UTF_8)); |
120 | 120 | else if (split.length == 1) |
121 | 121 | parameters.put(split[0], null); |
122 | 122 | } else { |
@@ -153,7 +153,7 @@ public String getParameter(String key) { |
153 | 153 | try { |
154 | 154 | String param = getPostParameters().get(key); |
155 | 155 | if(param != null) { |
156 | | - return URLEncoder.encode(param, StandardCharsets.UTF_8); |
| 156 | + return URLDecoder.decode(param, StandardCharsets.UTF_8); |
157 | 157 | } |
158 | 158 | return null; |
159 | 159 | } catch (MissingPostDataException | UnknownContentTypeException e) { |
@@ -183,7 +183,7 @@ public String[] getUriParts() { |
183 | 183 | * @return the value of the parameter, always a string |
184 | 184 | */ |
185 | 185 | public String getParameter(String key, String def) { |
186 | | - return URLEncoder.encode(getParameters().getOrDefault(key, def), StandardCharsets.UTF_8); |
| 186 | + return URLDecoder.decode(getParameters().getOrDefault(key, def), StandardCharsets.UTF_8); |
187 | 187 | } |
188 | 188 |
|
189 | 189 | public String getPath() { |
|
0 commit comments