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

feat: warn when json validator does not find a content type in the request #3707

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Soviut
Copy link

@Soviut Soviut commented Nov 28, 2024

When a validator has a target 'json' it will now warn if a request is missing a Content-Type: application/json header.

Closes honojs/middleware#841

Added some docs too honojs/website#540

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@Soviut Soviut changed the title warn when json validator does not find a content type in the request feat: warn when json validator does not find a content type in the request Nov 28, 2024
@yusukebe
Copy link
Member

Thanks! I'll check it later.

Soviut added a commit to Soviut/website that referenced this pull request Nov 30, 2024
- Fixed a code typo that said `.get` instead of `.post`
- Updated wording about "warning" in anticipation of honojs/hono#3707
- Reworded code block descriptors
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

Successfully merging this pull request may close these issues.

zod-validator should show a more useful error when JSON body is missing content-type header
2 participants