Skip to content

refactor: move common request validation to read function #600

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Phillip9587
Copy link
Contributor

This PR moves the common request validation logic, previously duplicated across all parsers, into the read function. This improves maintainability, reduces package size, and brings us closer to our goal of a generic body parser (see #22).

It also adds support for the defaultCharset option in normalizeOptions(). This option was already supported in the qs and text parsers, and I’ve now added support in the json parser as well. While we’ll likely want to validate these options more thoroughly in a future major release, the current approach should suffice for now.

There’s not much left before we can move the full middleware creation logic into its own function, but I wanted to keep this PR focused and manageable. Small steps toward our goals.

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.

1 participant