Skip to content

Commit 87d151b

Browse files
committed
aadarsh-st/SK-2521-Added new constant
1 parent b2fc152 commit 87d151b

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/java/com/skyflow/utils/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public final class Constants {
3434
public static final String ERROR_FROM_CLIENT_HEADER_KEY = "error-from-client";
3535
public static final String PROCESSED_FILE_NAME_PREFIX = "processed-";
3636
public static final String DEIDENTIFIED_FILE_PREFIX = "deidentified";
37+
public static final String CURLY_PLACEHOLDER = "{%s}";
38+
3739
public static final class HttpHeader {
3840
public static final String CONTENT_TYPE = "content-type";
3941
public static final String CONTENT_TYPE_JSON = "application/json";

src/main/java/com/skyflow/utils/HttpUtility.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public static String sendRequest(String method, URL url, JsonObject params, Map<
5858
String requestContentType = connection.getRequestProperty(Constants.HttpHeader.CONTENT_TYPE);
5959

6060
// Check if this is a raw body (XML, plain text, etc.)
61-
if (params.has("__raw_body__") && params.size() == 1) {
62-
input = params.get("__raw_body__").getAsString().getBytes(StandardCharsets.UTF_8);
61+
if (params.has(Constants.HttpUtilityExtra.RAW_BODY_KEY,) && params.size() == 1) {
62+
input = params.get(Constants.HttpUtilityExtra.RAW_BODY_KEY,).getAsString().getBytes(StandardCharsets.UTF_8);
6363
} else if (requestContentType != null && requestContentType.contains(Constants.HttpHeader.CONTENT_TYPE_FORM_URLENCODED)) {
6464
input = formatJsonToFormEncodedString(params).getBytes(StandardCharsets.UTF_8);
6565
} else if (requestContentType != null && requestContentType.contains(Constants.HttpHeader.CONTENT_TYPE_MULTIPART)) {

src/main/java/com/skyflow/utils/Utils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ public static String constructConnectionURL(ConnectionConfig config, InvokeConne
114114
String value = entry.getValue();
115115
try {
116116
String encodedValue = URLEncoder.encode(value, StandardCharsets.UTF_8.name());
117-
filledURL = new StringBuilder(filledURL.toString().replace(String.format("{%s}", key), encodedValue));
117+
filledURL = new StringBuilder(filledURL.toString().replace(String.format(Constants.CURLY_PLACEHOLDER, key), encodedValue));
118118
} catch (Exception e) {
119-
filledURL = new StringBuilder(filledURL.toString().replace(String.format("{%s}", key), value));
119+
filledURL = new StringBuilder(filledURL.toString().replace(String.format(Constants.CURLY_PLACEHOLDER, key), value));
120120
}
121121
}
122122
}

0 commit comments

Comments
 (0)