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

.is('xml') not accepting text/xml #617

Closed
jstans opened this issue Dec 4, 2015 · 4 comments
Closed

.is('xml') not accepting text/xml #617

jstans opened this issue Dec 4, 2015 · 4 comments

Comments

@jstans
Copy link

jstans commented Dec 4, 2015

I noticed that this.request.is('xml') would return false on a content-type of text/xml but not application/xml, leading many libraries which rely on using this functionality to detect xml to not work when the text/xml content-type is used.

I've done some inspection and it appears this is coming from the mime-types library, which only returns a single match for an extension which can exist multiple times in mime-db.

Should a solution to this be looked at, or should libraries be updated to check for both application/xml and text/xml?

@tj
Copy link
Member

tj commented Dec 6, 2015

Hmm ideally mime-db so we don't have to special-case anything in here.

@jonathanong
Copy link
Member

@dougwilson would know better. is text/xml a valid mime type?

you could also try this.request.is('*/xml') - that should work

@dougwilson
Copy link
Contributor

It is a valid type, but the limitation is that type-is, when given a file extension like "xml" just does a lookup in mime-types, which itself has a limitation of just the file extension to the "best fit" type, which is application/xml, the current official universal type for xml. It is on the backlog to provide a list, but in order to do that, the issues in mime-db need to be resolved so that things like mime-types can return arrays in the proper preferred order when inverting the lookup map.

@jonathanong
Copy link
Member

@jstans i'm closing this. here's the relevant issues list: https://github.com/jshttp/mime-db/issues

thanks!

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

No branches or pull requests

4 participants