@@ -1689,9 +1689,8 @@ private void readDirectQueryBindings(GenerationContext context, List<HttpBinding
1689
1689
writer .openBlock ("if (query[$S] !== undefined) {" , "}" , binding .getLocationName (), () -> {
1690
1690
Shape target = context .getModel ().expectShape (binding .getMember ().getTarget ());
1691
1691
if (target instanceof CollectionShape ) {
1692
- writer .write ("const decoded = Array.isArray(query[$1S]) ? (query[$1S] as string[])"
1693
- + ".map(e => decodeURIComponent(e)) : [decodeURIComponent(query[$1S] as string)];" ,
1694
- binding .getLocationName ());
1692
+ writer .write ("const queryValue = Array.isArray(query[$1S]) ? (query[$1S] as string[])"
1693
+ + " : [query[$1S] as string];" , binding .getLocationName ());
1695
1694
} else {
1696
1695
writer .addImport ("SerializationException" ,
1697
1696
"__SerializationException" ,
@@ -1701,10 +1700,10 @@ private void readDirectQueryBindings(GenerationContext context, List<HttpBinding
1701
1700
() -> {
1702
1701
writer .write ("throw new __SerializationException();" );
1703
1702
});
1704
- writer .write ("const decoded = decodeURIComponent( query[$1S] as string) ;" ,
1703
+ writer .write ("const queryValue = query[$1S] as string;" ,
1705
1704
binding .getLocationName ());
1706
1705
}
1707
- String queryValue = getOutputValue (context , binding .getLocation (), "decoded " ,
1706
+ String queryValue = getOutputValue (context , binding .getLocation (), "queryValue " ,
1708
1707
binding .getMember (), target );
1709
1708
writer .write ("contents.$L = $L;" , memberName , queryValue );
1710
1709
});
@@ -1721,12 +1720,12 @@ private void readMappedQueryBindings(GenerationContext context, HttpBinding mapp
1721
1720
valueType = "string[]" ;
1722
1721
}
1723
1722
writer .write ("let parsedQuery: { [key: string]: $L } = {}" , valueType );
1724
- String parsedValue = getOutputValue (context , mappedBinding .getLocation (),
1725
- "decoded" , target .getValue (), valueShape );
1726
1723
writer .openBlock ("for (const [key, value] of Object.entries(query)) {" , "}" , () -> {
1724
+ final String parsedValue ;
1727
1725
if (valueShape instanceof CollectionShape ) {
1728
- writer .write ("const decoded = Array.isArray(value) ? (value as string[])"
1729
- + ".map(e => decodeURIComponent(e)) : [decodeURIComponent(value as string)];" );
1726
+ writer .write ("const valueArray = Array.isArray(value) ? (value as string[]) : [value as string];" );
1727
+ parsedValue = getOutputValue (context , mappedBinding .getLocation (),
1728
+ "valueArray" , target .getValue (), valueShape );
1730
1729
} else {
1731
1730
writer .addImport ("SerializationException" ,
1732
1731
"__SerializationException" ,
@@ -1735,9 +1734,10 @@ private void readMappedQueryBindings(GenerationContext context, HttpBinding mapp
1735
1734
() -> {
1736
1735
writer .write ("throw new __SerializationException();" );
1737
1736
});
1738
- writer .write ("const decoded = decodeURIComponent(value as string);" );
1737
+ parsedValue = getOutputValue (context , mappedBinding .getLocation (),
1738
+ "value as string" , target .getValue (), valueShape );
1739
1739
}
1740
- writer .write ("parsedQuery[decodeURIComponent( key) ] = $L;" , parsedValue );
1740
+ writer .write ("parsedQuery[key] = $L;" , parsedValue );
1741
1741
});
1742
1742
String memberName = context .getSymbolProvider ().toMemberName (mappedBinding .getMember ());
1743
1743
writer .write ("contents.$L = parsedQuery;" , memberName );
0 commit comments