Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sumitsum committed Feb 10, 2021
1 parent 847d08d commit 3698cf5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public String convertPropertyListToReqBody(List<Property> bodyFormData,
String value = property.getValue();

if (MediaType.APPLICATION_FORM_URLENCODED_VALUE.equals(reqContentType)
&& (encodeParamsToggle == null || encodeParamsToggle == true)) {
&& encodeParamsToggle == true) {
try {
value = URLEncoder.encode(value, StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException e) {
Expand Down Expand Up @@ -515,7 +515,7 @@ private URI createFinalUriWithQueryParams(String url,
* - If encodeParamsToggle is null, then assume it to be true because params are supposed to be
* encoded by default, unless explicitly prohibited by the user.
*/
if(encodeParamsToggle == null || encodeParamsToggle == true) {
if(encodeParamsToggle == true) {
uriBuilder.queryParam(
URLEncoder.encode(key, StandardCharsets.UTF_8),
URLEncoder.encode(queryParam.getValue(), StandardCharsets.UTF_8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,6 @@ public void testEncodingFunctionWithEncodeParamsToggleTrue() throws UnsupportedE
assertEquals(expected_value, encoded_value);
}

@Test
public void testEncodingFunctionWithEncodeParamsToggleNull() throws UnsupportedEncodingException {
String encoded_value = pluginExecutor.convertPropertyListToReqBody(List.of(new Property("key", "valüe")),
"application/x-www-form-urlencoded",
null);
String expected_value = null;
try {
expected_value = "key=" + URLEncoder.encode("valüe", StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException e) {
throw e;
}
assertEquals(expected_value, encoded_value);
}

@Test
public void testEncodingFunctionWithEncodeParamsToggleFalse() throws UnsupportedEncodingException {
String encoded_value = pluginExecutor.convertPropertyListToReqBody(List.of(new Property("key", "valüe")),
Expand Down

0 comments on commit 3698cf5

Please sign in to comment.