mirror of
https://github.com/apache/jclouds.git
synced 2025-02-16 15:08:28 +00:00
Merge pull request #440 from andreisavu/1.4.x-decode-key
Decode both the key and the value when parsing the request URI
This commit is contained in:
commit
fc58a77381
@ -231,9 +231,7 @@ public class VirtualMachineClientLiveTest extends BaseCloudStackClientLiveTest {
|
||||
@Override
|
||||
public boolean apply(@Nullable Network network) {
|
||||
return network.isDefault() &&
|
||||
network.getGuestIPType() == GuestIPType.VIRTUAL &&
|
||||
network.getNetworkOfferingId() == 6 &&
|
||||
network.getId() == 204;
|
||||
network.getGuestIPType() == GuestIPType.VIRTUAL;
|
||||
}
|
||||
}));
|
||||
logger.info("Required network: " + requiredNetwork);
|
||||
|
@ -170,7 +170,7 @@ public class ModifyRequest {
|
||||
int indexOfFirstEquals = stringToParse.indexOf('=');
|
||||
String key = indexOfFirstEquals == -1 ? stringToParse : stringToParse.substring(0, indexOfFirstEquals);
|
||||
String value = indexOfFirstEquals == -1 ? null : stringToParse.substring(indexOfFirstEquals + 1);
|
||||
map.put(key, Strings2.urlDecode(value));
|
||||
map.put(Strings2.urlDecode(key), Strings2.urlDecode(value));
|
||||
}
|
||||
|
||||
public static String makeQueryLine(Multimap<String, String> params,
|
||||
|
@ -147,4 +147,12 @@ public class ModifyRequestTest {
|
||||
assertEquals(parsedMap.get("publickey"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseQueryWithKeysThatRequireDecoding() {
|
||||
Multimap<String, String> parsedMap = parseQueryToMap("network%5B0%5D.id=23&network%5B0%5D.address=192.168.0.1");
|
||||
|
||||
assertEquals(parsedMap.get("network[0].id"), ImmutableSet.of("23"));
|
||||
assertEquals(parsedMap.get("network[0].address"), ImmutableSet.of("192.168.0.1"));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user