-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from skyflowapi/release/12.04.2022
Release/12.04.2022
- Loading branch information
Showing
9 changed files
with
219 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.skyflow.logs; | ||
|
||
public enum DebugLogs { | ||
|
||
FormatRequestBodyFormUrlFormEncoded("Formatting request body for form-urlencoded content-type"), | ||
FormatRequestBodyFormData("Formatting request body for form-data content-type"); | ||
private final String log; | ||
|
||
DebugLogs(String log) { | ||
this.log = log; | ||
} | ||
|
||
public String getLog() { | ||
return log; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.skyflow.common.utils; | ||
|
||
import org.json.simple.JSONObject; | ||
import org.junit.Test; | ||
|
||
public class HelpersTest { | ||
|
||
@Test | ||
public void testFormatJsonToFormEncodedString(){ | ||
JSONObject testJson = new JSONObject(); | ||
testJson.put("key1","value1"); | ||
JSONObject nestedObj = new JSONObject(); | ||
nestedObj.put("key2","value2"); | ||
testJson.put("nest",nestedObj); | ||
|
||
String testResponse = Helpers.formatJsonToFormEncodedString(testJson); | ||
System.out.println(testResponse); | ||
assert testResponse.contains("key1=value1"); | ||
assert testResponse.contains("nest[key2]=value2"); | ||
} | ||
|
||
@Test | ||
public void testFormatJsonToMultiPartFormDataString(){ | ||
JSONObject testJson = new JSONObject(); | ||
testJson.put("key1","value1"); | ||
JSONObject nestedObj = new JSONObject(); | ||
nestedObj.put("key2","value2"); | ||
testJson.put("nest",nestedObj); | ||
String testBoundary = "123"; | ||
String testResponse = Helpers.formatJsonToMultiPartFormDataString(testJson,testBoundary); | ||
assert testResponse.contains("--"+testBoundary); | ||
assert testResponse.contains("--"+testBoundary+"--"); | ||
assert testResponse.contains("Content-Disposition: form-data; name=\"key1\""); | ||
assert testResponse.contains("value1"); | ||
assert testResponse.contains("Content-Disposition: form-data; name=\"nest[key2]\""); | ||
assert testResponse.contains("value2"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters