Skip to content

Commit 19bada0

Browse files
committed
Fix edge use-case for basestring generation behavior for keypair with null value
1 parent 27fa7e9 commit 19bada0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/com/api/util/ApiSecurity/ApiList.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ public void add(String key, String value)
2121
this.add(item);
2222
}
2323

24-
public String toString() {
24+
public String toString(Boolean isBaseString) {
2525
String delimiter = "&";
2626
Boolean sort = true;
2727
Boolean quote = false;
2828

29-
return this.toString(delimiter, sort, quote);
29+
return this.toString(delimiter, sort, quote, isBaseString);
3030
}
3131

32-
public String toString(String delimiter, Boolean sort, Boolean quote)
32+
public String toString(String delimiter, Boolean sort, Boolean quote, Boolean isBaseString)
3333
{
3434
List<String> list = new ArrayList<String>();
3535

@@ -43,7 +43,7 @@ public String toString(String delimiter, Boolean sort, Boolean quote)
4343
return l1.getKey().equals(l2.getKey()) ? l1.getValue().compareTo(l2.getValue())
4444
: l1.getKey().compareTo(l2.getKey());
4545
})
46-
.map(e -> String.format(format, e.getKey(), e.getValue()))
46+
.map(e -> (e.getValue()=="" && isBaseString) ? e.getKey() : String.format(format, e.getKey(), e.getValue()) )
4747
.collect(Collectors.toList());
4848
} else{
4949
list = this.stream().map(e -> String.format(format, e.getKey(), e.getValue()))

0 commit comments

Comments
 (0)