Json-server: Case insensitive request

Created on 2 May 2017  路  3Comments  路  Source: typicode/json-server

No results are returned when a parameter is all lowercase but the value in db.json is starts with an uppercase letter. For example:
GET request: url/user?city=new+york
in db.json: city: "New York"

Is there a way to make searching case insensitive?

Most helpful comment

use _like operator
GET request:

url/user?city_like=new+york

All 3 comments

use _like operator
GET request:

url/user?city_like=new+york

@ikrum is there any option to not affect how calls are performed?

From my understanding, this requires to add _like to any request that need to be considered "case insensitive".

If the front-end configuration leverages only a configuration on the base url and leaves the rest (endpoint) the same, this solution is then not that convenient at all.

Atm it seems that the only workaround would be to create all the endpoints with all the mixed combinations of upper and lowercase... which not that convenient either.

I am gonna open a new issue about "Case-insensitive resources" which can be the case IRL: https://github.com/typicode/json-server/issues/995

use _like operator
GET request:

url/user?city_like=new+york

Thank you 馃憤

But what if we want to get case insensitive search with full-text match

Ex:- {"Articles": [
{
"title": "Google",
},
{
"title": "google",
},
{
"title": "google 1",
},
}
if I get
Articles?title=google -> out put's the second
Articles?title=Google -> out put's the first
but
Articles?title_like =google -> out put's all the three
instead, I should get first and second

How to fix the above issue

Thank You!!

Was this page helpful?
0 / 5 - 0 ratings