-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Normalize request body ContentTypes #863
Normalize request body ContentTypes #863
Conversation
828cd1e
to
7250470
Compare
Has anybody had a chance to review this? |
} | ||
types.push(new ContentType(this.mediaType)); | ||
|
||
if (!this.parameters['charset']) { |
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.
Looks like this will add utf-8 as an equivalent content type 👍
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.
Glad you noticed. I saw that you were accounting for utf-8 and wanted to make sure I maintained that.
src/middlewares/util.ts
Outdated
return types; | ||
} | ||
|
||
public normalize(excludeParams: string[] = ['boundary']) { |
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.
Nit: add the method’s return type
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.
Done!
Getting to this now. Looks good. Thank you! One minor review nit |
01a3502
to
169ce03
Compare
Thanks for the review! I went ahead and made the update, rebased, and squashed. It's ready for another look. |
Fixes #862
First I tackled ensuring that any ContentType type could be normalized so we could perform easy comparisons between what an HTTP request may send vs what the openapi document is expecting. By normalizing as well, I was able to easily ensure that cache keys for validators don't have any conflicts.
Tests have been added to showcase the working solution.