When passing multiple filter values with the same name (in the query) an error response is returned.
Examples of when this may be needed are:
Filtering on a numeric range (greater than 1, less than 5)
Filtering on text containing and not containing (containing "test" but not "user")
This is due to the fact that the value variable in ListArgsBinder.LoadFromQueryString() is actually a Microsoft.Extensions.Primitives.StringValues (ie can be multiple) but is treated like a string.
Steps to reproduce
Create Product in OrderCloud with:
a numeric xp property (eg. testnumber with value of 2)
a text xp property (eg. author with value of test)
Clone Headstart (or create your own API controller using Catalyst)
Call /me/products?xp.testnumber=>1&xp.testnumber=<5 and observe the error
Call /me/products?xp.author=test*&xp.author=!*user and debug the value of filters passed through to oc.Me.ListProductsAsync():
xp.author=test*,!*user
which is not the expected value of xp.author=test*&xp.author=!*user
The same issue occurs (for the same reason) if the filters are instead passed through using a JSON body with property filters .
Sample body:
Issue
When passing multiple filter values with the same name (in the query) an error response is returned.
Examples of when this may be needed are:
This is due to the fact that the
value
variable inListArgsBinder.LoadFromQueryString()
is actually aMicrosoft.Extensions.Primitives.StringValues
(ie can be multiple) but is treated like a string.Steps to reproduce
testnumber
with value of2
)author
with value oftest
)/me/products?xp.testnumber=>1&xp.testnumber=<5
and observe the error/me/products?xp.author=test*&xp.author=!*user
and debug the value offilters
passed through tooc.Me.ListProductsAsync()
:xp.author=test*,!*user
which is not the expected value ofxp.author=test*&xp.author=!*user
The same issue occurs (for the same reason) if the filters are instead passed through using a JSON body with property
filters
. Sample body: