You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggestion: Make Body.fromString default to returning HTML documents #190
Currently, creating a default body will set the MIME type to text/plain, which seems to be a rather uncommon use case. Perhaps. the default should instead be MimeType.html (text/html). This would make the API behave a tad bit more as expected.
The MimeTypeResolver class can be used to determine the MIME type of a file. It supports both using the extension of the file name and looking at magic bytes from the beginning of the file.
This seems not to be applicable to other things than files? It doesn't look at the content (other than the magic bytes).
This seems not to be applicable to other things than files? It doesn't look at the content (other than the magic bytes).
If you pass an empty file-name it will look at just the header bytes. However, TIL it works only for binary mime-types. For text/* mime-types you need something different.
Activity
nielsenko commentedon Oct 7, 2025
Perhaps it would be better to use a
MimeTypeResolver(from packagemime) in case no mime-type is set.vlidholt commentedon Oct 7, 2025
From the
mimedocs:This seems not to be applicable to other things than files? It doesn't look at the content (other than the magic bytes).
nielsenko commentedon Oct 8, 2025
If you pass an empty file-name it will look at just the header bytes. However, TIL it works only for binary mime-types. For text/* mime-types you need something different.