-
Notifications
You must be signed in to change notification settings - Fork 51
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
change the mime type for dart source #19
Conversation
Generally SGTM. |
Thoughts @nex3 @natebosch @jakemac53 ? Devon: what scenario are you working on here? Just curious... |
This seems sensible to me. @vsmenon any concerns around source maps or anything? |
I was working on a server that served file listings for directories (and file contents for files) - based on https://github.com/dart-lang/shelf_static. I noticed that the dart source files were the only file type that couldn't be displayed. Given that they're just straight text files, it was odd and a bit inconvenient. It's not really a deal breaker type of thing, but likely inconsistent with where we should be, given the current dart4web support (dart2js+DDC, rather than Dartium).
Good question! I don't know of any, but worth gathering input here.
I found references here:
And there are likely others. And in terms of other language mime types, I found: |
Sounds good to me, do we need to treat this as a breaking change? |
Moving away from Does the pubspec already imply that this package will not work with Dartium? |
@vsmenon - the min SDK is Technically this could be used on a server which still has a Dartium client, but I think the risk there is low. |
change the mime type for dart source
Change the mime type for Dart source from
application/dart
totext/x-dart
.When working on a server serving up a browser based directory listing, I noticed that Dart source files were not displayed by the browser, but instead popped up a dialog asking to save them as binary content. Other source files (css, html, ...) were instead displayed in the browser.
The server was reporting
application/dart
as the mime type for Dart files. Theapplication/
prefix is an indication to the browser that the file has binary content; as the browser didn't understand that binary format, it didn't attempt to display it.Previously we had native processors of Dart files (and the
application/dart
mime type) - Dartium; however executable Dart on the web now just exists in the form of compiled JS files.I think we should change the default mime type of Dart files to something that browsers will recognize as text based. From a quick perusal of other languages (and reading https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types), this would be something like
text/x-dart
.@kevmoo @anders-sandholm