Skip to content

Error responses #352

Closed
Closed
@netsi1964

Description

@netsi1964

If I do say:

http://localhost:3000/posts?q=serve&q=comment

The case here has two q parameters, which confuses the search routine.
It should take only the first parameter or respond with a JSON based error (?).

I get an error text like this:

TypeError: q.toLowerCase is not a function at list (/usr/local/lib/node_modules/json-server/src/server/router/plural.js:89:13) at Layer.handle [as handle_request] (/usr/local/lib/node_modules/json-server/node_modules/express/lib/router/layer.js:95:5) at next (/usr/local/lib/node_modules/json-server/node_modules/express/lib/router/route.js:131:13) at Route.dispatch (/usr/local/lib/node_modules/json-server/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/usr/local/lib/node_modules/json-server/node_modules/express/lib/router/layer.js:95:5) at /usr/local/lib/node_modules/json-server/node_modules/express/lib/router/index.js:277:22 at Function.process_params (/usr/local/lib/node_modules/json-server/node_modules/express/lib/router/index.js:330:12) at next (/usr/local/lib/node_modules/json-server/node_modules/express/lib/router/index.js:271:10) at Function.handle (/usr/local/lib/node_modules/json-server/node_modules/express/lib/router/index.js:176:3) at router (/usr/local/lib/node_modules/json-server/node_modules/express/lib/router/index.js:46:12)

could be better if it had some JSON error :-)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions