Skip to content

Case-insensitive resources #995

Description

@natalie-o-perret

This is a follow-up of my comment on the issue: Case insensitive request which only addresses the request side of things.

I would like to see something similar for resources in order etc avoid changing the way requests are done (which is often the case when the different environments of the front-end solution change the base url and not how the requests are done themselves).

To me that would defeat a bit the purpose of json-server, since it cannot reproduce how an actual server interpret requests (and this can happened to be case-insensitive irl).

For example with the current configuration:

routes.json:

{
	"/api/v1/*": "/$1",
}

db.json:

{
	"operations": [
		{
			"code": "emp",
			"operationCode": "EMPTY"
		},
		{
			"code": "empt",
			"operationCode": "EMPTY"
		},
		{
			"code": "empty",
			"operationCode": "EMPTY"
		},

So when requests with axios are done with something like: api/v1/operations/emp/, it works but if I am doing api/v1/operations/EmP/ I get a 404.

Is there something already built-in that allows me to have case-insensitive behaviour on my resources and at the same time avoid changing the way requests are performed (that is changing the end point to add like).

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions