Skip to content

Parse media types with mime#1383

Draft
danieleades wants to merge 1 commit into
oxidecomputer:mainfrom
danieleades:agent/parse-media-types-with-mime
Draft

Parse media types with mime#1383
danieleades wants to merge 1 commit into
oxidecomputer:mainfrom
danieleades:agent/parse-media-types-with-mime

Conversation

@danieleades

Copy link
Copy Markdown

Summary

  • declare mime as a direct dependency of progenitor-impl
  • parse request body content types with mime::Mime and classify them by their parameter-free essence
  • use the same MIME parsing behavior when detecting JSON responses
  • add focused coverage for parameters, case normalization, unsupported structured suffixes, and malformed media types

Why

Media types were previously handled with two separate string-based approaches: request bodies sliced at the first semicolon, while responses used equality and prefix checks. Using a media type parser centralizes the syntax handling and makes the supported content-type policy explicit.

Impact

Existing supported body types retain their generated behavior. Valid media type parameters and case variations are handled consistently, while application/problem+json remains unsupported rather than implicitly changing the generator's structured-suffix policy.

Validation

  • cargo fmt --all -- --check
  • cargo test -p progenitor-impl (17 unit tests, 9 output tests, and 3 non-network specific tests passed in the sandbox)
  • cargo test -p progenitor-impl --test test_specific (4/4 passed with localhost binding enabled)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant