Skip to content

Commit

Permalink
fix: Provide URL path segment encoder in place of URLParameters: path…
Browse files Browse the repository at this point in the history
… segment and parameters are differents (path segment 'space' encoding have to '%20' and not '+' sign)
  • Loading branch information
JPPortier committed Nov 24, 2023
1 parent 56f1cdf commit f29f8db
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions core/src/main/com/sinch/sdk/core/http/URLPathUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.sinch.sdk.core.http;

import com.sinch.sdk.core.utils.StringUtil;
import java.net.URI;
import java.net.URISyntaxException;

public class URLPathUtils {

public static String encodePathSegment(String segment) {

System.out.println("jpp segment: " + segment);

if (StringUtil.isEmpty(segment)) {
return "";
}
URI uri;
try {
uri = new URI("foo", "foo", "/" + segment, null);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
return uri.getRawPath().substring(1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void run() {

String reference = "a reference";

LOGGER.info("Get status by reference for : " + reference);
LOGGER.info("Get status by reference for: '" + reference + "'");

VerificationReport response = client.verification().status().getByReference(reference);
LOGGER.info("Response :" + response);
Expand Down

0 comments on commit f29f8db

Please sign in to comment.