Closed yogthos closed 1 month ago
The resources aren't served with any content-type. The text/plain
media type is probably being added by the adapter you're using.
I'm not sure how useful setting the content-type is, when the wrap-content-type
middleware can be layered over the top to provide the same functionality. I guess it makes sense not to return a response without a correct media type, however.
Right, wrapping wrap-content-type
manually would be the solution, but it doesn't seem unreasonable for the assets to have the correct content type set out of the box.
Currently wrap-resource
doesn't add the content-type either, as guessing the content-type from the file extension isn't 100% reliable. There are also more sophisticated ways of checking the media type of a file; Java 7 comes with Files/probeContentType, for instance.
I think keeping the content-type middleware separate makes the most sense, as people can then choose which middleware they want to use to determine the media type of the served resources. It might sacrifice some convenience, but I think it's worth the additional simplicity. Perhaps a note could be added to the README, however.
I think documenting this would a reasonable approach as well.
it would be nice to set correct mime types for at least some known resources such as css and js