tower-rs / tower-http

HTTP specific Tower utilities.
682 stars 159 forks source link

consider supporting custom mime type in serve_dir? #500

Open ibigbug opened 1 month ago

ibigbug commented 1 month ago

Feature Request

current mime_guess is a hardcoded list.

taking a callback to optionally allow mapping certain file exts to something other than the hardcoded list would be helpful

Motivation

some types are missed in the mime_guess, and sometimes people may want to intentionally override the mime for well known file types

Proposal

take a callback and if it's set, preferred over here https://github.com/tower-rs/tower-http/blob/main/tower-http/src/services/fs/serve_dir/open_file.rs#L76

Alternatives