[OLINGO-846] Trim query option values
This commit is contained in:
parent
e5d1e823c5
commit
570f4317ce
|
@ -48,7 +48,8 @@ public class UriDecoder {
|
|||
for (final String option : split(queryOptionString, '&')) {
|
||||
final int pos = option.indexOf('=');
|
||||
final String name = pos >= 0 ? option.substring(0, pos) : option;
|
||||
final String text = pos >= 0 ? option.substring(pos + 1) : "";
|
||||
//OLINGO-846 We trim the query option text to be more lenient to wrong uri constructors
|
||||
final String text = pos >= 0 ? option.substring(pos + 1).trim() : "";
|
||||
queryOptions.add(new CustomQueryOptionImpl()
|
||||
.setName(decode(name))
|
||||
.setText(decode(text)));
|
||||
|
|
|
@ -57,6 +57,17 @@ public class TestFullResourcePath {
|
|||
private final TestUriValidator testUri = new TestUriValidator().setEdm(edm);
|
||||
private final FilterValidator testFilter = new FilterValidator().setEdm(edm);
|
||||
|
||||
@Test
|
||||
public void trimQueryOptionsValue() throws Exception {
|
||||
// OLINGO-846 trim query option value
|
||||
testUri.run("ESAllPrim", "$filter= PropertyInt16 eq 12 ")
|
||||
.isKind(UriInfoKind.resource).goPath()
|
||||
.first().isEntitySet("ESAllPrim");
|
||||
// OLINGO-846 trim query option value
|
||||
testUri.run("ESAllPrim", "$filter= PropertyInt16 eq 12 ")
|
||||
.isKind(UriInfoKind.resource).goFilter().isBinary(BinaryOperatorKind.EQ).is("<<PropertyInt16> eq <12>>");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void valueOnNonMediaEntity() throws Exception {
|
||||
testUri.runEx("ESAllPrim/$value").isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS);
|
||||
|
@ -952,14 +963,14 @@ public class TestFullResourcePath {
|
|||
"$expand=ESTwoPrim")
|
||||
.goExpand()
|
||||
.first().goPath().first().isEntitySet("ESTwoPrim");
|
||||
|
||||
|
||||
testUri.run("$crossjoin(ESTwoPrim,ESAllPrim)",
|
||||
"$expand=ESTwoPrim,ESAllPrim")
|
||||
.goExpand()
|
||||
.first().goPath().first().isEntitySet("ESTwoPrim")
|
||||
.goUpExpandValidator().next().goPath().first().isEntitySet("ESAllPrim");
|
||||
|
||||
//TODO: Once crossjoin is implemented these tests should no longer result in errors
|
||||
// TODO: Once crossjoin is implemented these tests should no longer result in errors
|
||||
// testUri.run("$crossjoin(ESTwoPrim,ESAllPrim)",
|
||||
// "$expand=ESAllPrim/NavPropertyETTwoPrimOne")
|
||||
// .goExpand()
|
||||
|
|
Loading…
Reference in New Issue