consider supporting custom mime type in serve_dir?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start in tower-http/src/services/fs/serve_dir/open_file.rs at the existing mime_guess handling referenced by the issue. Trace how serve_dir opens files and determine the callback shape and precedence over the hardcoded MIME mapping. Done means callers can optionally provide custom extension-to-MIME mappings while existing behavior remains unchanged.
Written by the indexing model from the issue text.
Description
- I have looked for existing issues (including closed) about this
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
- Dominant language
- Rust
- Stars
- 913
- Forks
- 231
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tower-rs/tower-http
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
tower-rs/tower-http#737 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
tower-rs/tower-http#732 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
tower-rs/tower-http#731 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
tower-rs/tower-http#701 · 2 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
tower-rs/tower-http#657 · 12 comments · 1 reaction ·
All issues in tower-rs/tower-http
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100