json-server icon indicating copy to clipboard operation
json-server copied to clipboard

URL containing name of the property in defined response returns empty array || object

Open nmitic opened this issue 5 years ago • 1 comments

With giving json-server setup after hitting the route "/api/v1/documents?docId=123" I am getting [] array as response.

Everything works fine when hitting "/doc" to inspect the response from json-server UI.

When I rename docId to something else everything is working fine. Same goes with if I rename url not to contain docId

Version: 0.14.2

db.js module.exports = () => ({ doc: require('./doc.json'), })

routes.json

{ "/api/v1/documents?docId=:Id": "/doc" }

doc.json [ { "name": "some name", docId: 123 } ]

Starting command >>> json-server -c json-server.json mockdb/db.js

nmitic avatar May 16 '19 13:05 nmitic

Also have the same issue with property names inside an array response. For me changing the name inside an existing api just to use it as a fake backend is not an option. Would appreciate an fix or any kind of news if this behaviour is intended.

Morenar avatar Jul 18 '22 13:07 Morenar