Skip to content

Commit c8211c8

Browse files
committed
Strip quotes from query string append #10
1 parent d10976b commit c8211c8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/AndroidClient/client/src/main/java/net/servicestack/client/JsonServiceClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public String createUrl(Object requestDto, Map<String,String> query){
100100
sb.append(sb.length() == 0 ? "?" : "&");
101101
sb.append(URLEncoder.encode(f.getName(), "UTF-8"));
102102
sb.append("=");
103-
sb.append(URLEncoder.encode(val.toString(), "UTF-8"));
103+
sb.append(URLEncoder.encode(Utils.stripQuotes(val.toString()), "UTF-8"));
104104
}
105105

106106
if (query != null) {

src/AndroidClient/client/src/main/java/net/servicestack/client/Utils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public static Double tryParseDouble(String str) {
5353
}
5454
}
5555

56+
57+
5658
public static Field[] getSerializableFields(Class type){
5759
List<Field> fields = new ArrayList<Field>();
5860
for (Class<?> c = type; c != null; c = c.getSuperclass()) {
@@ -71,6 +73,14 @@ public static Field[] getSerializableFields(Class type){
7173
return fields.toArray(new Field[fields.size()]);
7274
}
7375

76+
public static String stripQuotes(String str) {
77+
String result = str;
78+
if(str.indexOf("\"") == 0 && str.lastIndexOf("\"") == str.length() - 1) {
79+
result = str.substring(1,str.length()-1);
80+
}
81+
return result;
82+
}
83+
7484
public static void reverse(byte[] bytes) {
7585
if (bytes == null)
7686
return;

0 commit comments

Comments
 (0)