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

[Bug] koa-context-validator is throwing an error rather than returning a 400 response #20

Closed
1 task done
barthofu opened this issue Aug 17, 2022 · 0 comments · Fixed by #28
Closed
1 task done
Assignees
Labels
bug Something isn't working
Milestone

Comments

@barthofu
Copy link
Owner

What happened?

Not quite a bug but more of an unexpected behavior.
The koa-context-validator is throwing an error on the server when the request's query/body is not validated.
It would be better to return it to the client in the form of a 400 (bad argument) response error, with the Joi's error description as the response message.

But the middleware ecosystem of Koya is quite poor and rarely used.
I propose to either:

  • Create our own middleware (and possibly publish it on npm)
  • Switch to another web server (such as @node-decorators/express)

Reproduction

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@barthofu barthofu added the bug Something isn't working label Aug 17, 2022
@barthofu barthofu self-assigned this Aug 17, 2022
@barthofu barthofu changed the title [Bug] koa-context-validator is throwing error rather than returning a **400 response** [Bug] koa-context-validator is throwing error rather than returning a 400 response Aug 17, 2022
@barthofu barthofu changed the title [Bug] koa-context-validator is throwing error rather than returning a 400 response [Bug] koa-context-validator is throwing an error rather than returning a 400 response Aug 17, 2022
@barthofu barthofu added this to the v1.1 milestone Aug 17, 2022
barthofu added a commit that referenced this issue Aug 19, 2022
@barthofu barthofu linked a pull request Aug 19, 2022 that will close this issue
barthofu added a commit that referenced this issue Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant