Closed PyaePhyoKyaw61194 closed 2 years ago
I got 500 internal server error even though I put the name and email for body.
The Response
{
"success": false,
"message": "Something went wrong!",
"data": null,
"error": "[case `resolver`]: Invalid state"
}
The Request Body (tested in Thunder Client)
{
"name": "Mg Mg",
"email" : "mgmg@gmail.com"
}
Another test is , I added query validation( without body validation ) this time.
request: {
query: z.object({
limit: z.string(),
}),
},
I got the same error response if the zod validation is failed. (I did not add limit query string)
{
"success": false,
"message": "Something went wrong!",
"data": null,
"error": "[case `resolver`]: Invalid state"
}
Last time I checked , I think the error message is a bit more explicit zod error message like "limit is required " (same meaning like this).
@mm-ninja-turtles/core-maintainers
@wai-lin The problem is solved by adding router.use(express.json()) before router.setup({})
@PyaePhyoKyaw61194
I've updated the getting started guide. please read and do as it is.
From v0.2.0
, setup function only the route setup of paths. No more extra works. Which mean it doesn't enable express.json()
or express.urlencoded()
by default. Giving the user the full control of the app setup.
If this is resolved as you've said, I'll close this issue.
I tested this kind of example with request body