cashapp / misk

Microservice Kontainer
https://cashapp.github.io/misk/
391 stars 166 forks source link

Associate "text/plain" MediaType with "txt" extension #3261

Closed mericson-square closed 1 month ago

mericson-square commented 1 month ago

Websites may want to serve plain text files for well-known resources (e.g. robots.txt (RFC 9309), security.txt (RFC 9116)) but the current StaticResourceAction has no media type association for the txt extension, defaulting to application/octet-stream.

This PR associates the txt extension with the existing (unused) TEXT_PLAIN_UTF8_MEDIA_TYPE so that the response includes the expected content-type: text/plain;charset=utf-8 header.