diff --git a/core/src/main/com/sinch/sdk/core/http/URLPathUtils.java b/core/src/main/com/sinch/sdk/core/http/URLPathUtils.java new file mode 100644 index 00000000..14996bcb --- /dev/null +++ b/core/src/main/com/sinch/sdk/core/http/URLPathUtils.java @@ -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); + } +} diff --git a/sample-app/src/main/java/com/sinch/sample/verification/status/GetByReference.java b/sample-app/src/main/java/com/sinch/sample/verification/status/GetByReference.java index 6bff328a..6072bf02 100644 --- a/sample-app/src/main/java/com/sinch/sample/verification/status/GetByReference.java +++ b/sample-app/src/main/java/com/sinch/sample/verification/status/GetByReference.java @@ -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);