node-restify
node-restify copied to clipboard
Improving jsonContentType Regex
- [x] Used appropriate template for the issue type
- [x] Searched both open and closed issues for duplicates of this issue
- [x] Title adequately and concisely reflects the feature or the bug
I was getting a PR ready for this, but it said to discuss via Issues first, so here I am. I'm pretty sure this is a good fix, but let me know if I am wrong.
Original:
jsonContentType: new RegExp('^application/[a-zA-Z.]+\\+json')
(Link)
My proposed change:
jsonContentType: new RegExp('^application/[a-z0-9.]+\\+json$', 'i')
The original expression was incorrect because it was not checking 0-9
, so a valid Content-Type like this would not validate: application/vnd.Microsoft.IIS.Administration.Files.2.2.0+json
Also added the ending $
for completion, and replaced A-Z
with the i
flag to account for mixed case letters, and also the possibility of mixed case throughout the entire Content-Type.
Are you willing and able to fix this?
Yes
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Any feedback?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
👀
jsonContentType: new RegExp('^application/[a-z0-9.-]+\+json$', 'i')
-
to use in example application/merge-patch+json
Heya @EatonZ, this looks good to me :+1: will merge a PR implementing this assuming tests pass!
@retrohacker Any luck?