Open gumernus opened 1 year ago
Can you link me to the commit where the code which produced this issue is?
just tried /getPosts without a body and this happened: @HyScript7
we need the error handling 😭 (the filter should not be required i guess)
it runs perfectly fine with body:
{
"filters": {}
}
it runs perfectly fine with body:
{ "filters": {} }
okay i have fixed this in the routes but the error handling still needs to be done in the helper
Since I am not responsible for that part of the CRUD, I don't really know how to fix that, but since putting an empty filter works, I suppose setting the filter's default value to {} should fix this.
Edit: I haven't accounted for undefined
to be passed in the arguments, except for the post's update function, where we take advantage of undefined values.
Since I am not responsible for that part of the CRUD, I don't really know how to fix that, but since putting an empty filter works, I suppose setting the filter's default value to {} should fix this. Edit: I haven't accounted for
undefined
to be passed in the arguments, except for the post's update function, where we take advantage of undefined values.
well i have fixed it with this monster
let filters;
if (req.body.filters === undefined) { filters = { headline: "" } }
else if (typeof req.body.filters == "object") { filters = Object.keys(req.body.filters).length == 0 ? { headline: "" } : req.body.filters }
when running
curl -X POST -d "username=your_username&password=your_password" http://localhost:3000/api/login
. The user doesn't exist.