@@ -56,6 +56,7 @@ public final class RequestTemplate implements Serializable {
5656 private transient Charset charset ;
5757 private byte [] body ;
5858 private String bodyTemplate ;
59+ private boolean decodeSlash = true ;
5960
6061 public RequestTemplate () {
6162
@@ -71,6 +72,7 @@ public RequestTemplate(RequestTemplate toCopy) {
7172 this .charset = toCopy .charset ;
7273 this .body = toCopy .body ;
7374 this .bodyTemplate = toCopy .bodyTemplate ;
75+ this .decodeSlash = toCopy .decodeSlash ;
7476 }
7577
7678 private static String urlDecode (String arg ) {
@@ -200,7 +202,10 @@ public RequestTemplate resolve(Map<String, ?> unencoded) {
200202 for (Entry <String , ?> entry : unencoded .entrySet ()) {
201203 encoded .put (entry .getKey (), urlEncode (String .valueOf (entry .getValue ())));
202204 }
203- String resolvedUrl = expand (url .toString (), encoded ).replace ("%2F" , "/" ).replace ("+" , "%20" );
205+ String resolvedUrl = expand (url .toString (), encoded ).replace ("+" , "%20" );
206+ if (decodeSlash ) {
207+ resolvedUrl = resolvedUrl .replace ("%2F" , "/" );
208+ }
204209 url = new StringBuilder (resolvedUrl );
205210
206211 Map <String , Collection <String >>
@@ -246,12 +251,21 @@ public RequestTemplate method(String method) {
246251 this .method = checkNotNull (method , "method" );
247252 return this ;
248253 }
249-
254+
250255 /* @see Request#method() */
251256 public String method () {
252257 return method ;
253258 }
254259
260+ public RequestTemplate decodeSlash (boolean decodeSlash ) {
261+ this .decodeSlash = decodeSlash ;
262+ return this ;
263+ }
264+
265+ public boolean decodeSlash () {
266+ return decodeSlash ;
267+ }
268+
255269 /* @see #url() */
256270 public RequestTemplate append (CharSequence value ) {
257271 url .append (value );
0 commit comments