-
Notifications
You must be signed in to change notification settings - Fork 0
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: add header validation utilities #25
Conversation
numeric: jsonSchema.string(), | ||
bool: jsonSchema.string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JsonSchema offers no casting or I didn't find it.
objectSchema<any>({ | ||
shortstring: stringSchema.min(8).max(16), | ||
numeric: numberSchema, | ||
bool: stringSchema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The booleanSchema
does no casting, it simply screams in horror when it sees a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't believe it so I had to test myself, and indeed, you're right!
objectSchema<any>({ | ||
shortstring: stringSchema.min(8).max(16), | ||
numeric: numberSchema, | ||
bool: stringSchema, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't believe it so I had to test myself, and indeed, you're right!
🎉 This PR is included in version 5.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
In this PR, I added header validation utilities in the shape of:
validateRequest.headers
using JOIvalidateHeaders
using JsonSchemaOne potentially unexpected effect of these functions is
that they will produce lowercase headers (as the standard dictates)
since they rely on
req.headers
which contains lowercase keys.