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

Correct media_types API #4566

Closed
wants to merge 1 commit into from
Closed

Correct media_types API #4566

wants to merge 1 commit into from

Conversation

ry
Copy link
Member

@ry ry commented Apr 1, 2020

Fix #4292

cc @kitsonk

@kitsonk
Copy link
Contributor

kitsonk commented Apr 1, 2020

The purpose of the API is to normalise content-types, when users take shortcuts. See how this API is used in oak:

https://github.com/oakserver/oak/blob/99dfcda9d590b73a449e1258c7c0c2e4ab790b45/response.ts#L33-L40

So I would prefer to not make this change. Clearing up documentation of its purpose, or changing the name of the API to normalizeContentType would be better. The reason it resolves "extensions" is so that a user can set the content type to a response to something like "json" but end up with a full valid media type as output. It was never designed to do paths, as that feature is lookup().

@ry
Copy link
Member Author

ry commented Apr 2, 2020

Actually, now that I'm looking more deeply into this library, I'm not happy with it. I want to delete it from std. In file_server, the only place it's used, we can just use a small map of filename extensions.

@kitsonk
Copy link
Contributor

kitsonk commented Apr 2, 2020

Again, personally, I don't care. I originally ported it to oak because it was the easiest way to replicate functionality, but I always thought it was a bit overkill for a standard library, but people kept trying to build a whole express/koa type framework in standard, and this was an easy move to help stem that need.

@ry
Copy link
Member Author

ry commented Apr 2, 2020

OK then I'm going to remove media_types. I think it's better to kick this out into deno.land/x rather than support it forever #4594

@ry ry closed this Apr 2, 2020
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.

media_types API is not good
3 participants