WebAssembly / WebAssembly/WASI
Stream `media_type` should be Option<String>
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.8k
- Forks
- 333
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 3
Description
input_media_type and output_media_type mention:
Returns
*/*if the Media Type is unknown.
As far as I know, in the world of HTTP the string "*/*" is only used as a wildcard in places where a content type filter is expected (Accept header), indicating any content type will do. It is never used as a content type accompanying actual data. For these scenario's where the content type is unknown, "application/octet-stream" is generally used.
Additionally, according to RFC-7231 the content type should preferably not be set at all:
A sender that generates a message containing a payload body SHOULD generate a Content-Type header field in that message unless the intended media type of the enclosed representation is unknown to the sender. If a Content-Type header field is not present, the recipient MAY either assume a media type of "application/octet-stream" or examine the data to determine its type.
That leads me to think input_media_type & output_media_type should be changed to be an Option type returning None if the content type is unknown. Alternative solution would be to return an empty string, or "application/octet-stream". But not "*/*".
References:
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.
Research direction
Start by locating the input_media_type and output_media_type implementations and their callers. Review how unknown media types are currently represented, including any tests or documentation describing /, and compare the behavior with RFC 7231 section 3.1.1.5. Done means the API's unknown-media-type behavior is agreed, consistently implemented, and covered by updated callers and tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100