Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throws error when "id":1 exists in post request body #241

Open
iam-raihan opened this issue Jul 13, 2019 · 1 comment
Open

throws error when "id":1 exists in post request body #241

iam-raihan opened this issue Jul 13, 2019 · 1 comment

Comments

@iam-raihan
Copy link

found some minor cases. though these issues can be ignored by changing my code but still it'll be great if you look into these. specially 'case 2'

  • case 1: post request with body {"id":1,"name":"raihan"} throws below mentioned error! of
    course my id shouldn't be 1 but throwing error from server isn't convenient either.

  • case 2: post request with body {"id":"0","name":"raihan"} returns id as it is, "0". i think it
    should return new random id even if my id is string type.

  • case 3: post request with body {"id":0,"name":"raihan"} works fine though

Error: Insert failed, duplicate id
    at Function.insert (/app/node_modules/lodash-id/src/index.js:49:18)
    at /app/node_modules/lodash/lodash.js:4374:28
    at arrayReduce (/app/node_modules/lodash/lodash.js:683:21)
    at baseWrapperValue (/app/node_modules/lodash/lodash.js:4373:14)
    at LodashWrapper.wrapperValue (/app/node_modules/lodash/lodash.js:9052:14)
    at create (/app/node_modules/json-server/lib/server/router/plural.js:235:48)
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/app/node_modules/express/lib/router/route.js:137:13)
    at next (/app/node_modules/express/lib/router/route.js:131:14)
    at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
@gzdgkmnnn
Copy link

Yardimci olabilir misiniz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants