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

Recognize JSON and XML by media type suffixes #3

Merged
merged 2 commits into from
Aug 3, 2021

Conversation

scop
Copy link
Contributor

@scop scop commented Aug 1, 2021

Moved the XML match to after HTML with the assumption that these are processed in order, so that application/xhtml+xml still gets treated as HTML. It seems to for me in bat, but I haven't researched if that's guaranteed to be the case.

The regexps for suffix matching aren't that strict re the main type and beginning of the subtype, so they could match some invalid types. But I guess this would be ok for practical purposes.

@keith-hall
Copy link
Owner

can you give some real-world examples of media types which are not currently matched but will be after these changes, please? :)

@scop
Copy link
Contributor Author

scop commented Aug 2, 2021

Searching for +xml and +json at https://www.iana.org/assignments/media-types/ gives an overview of such types. The ones immediately springing to mind for me at the moment are image/svg+xml, application/merge-patch+json and application/problem+json.

@keith-hall keith-hall merged commit 7e6fb45 into keith-hall:master Aug 3, 2021
@keith-hall
Copy link
Owner

Thanks! Btw, do you want your name in the credits somewhere? as you are a great help with testing and making improvements :)

@scop scop deleted the media-type-suffixes branch August 3, 2021 06:33
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.

2 participants