Skip to content

fix: content type validation should be case insensitive - #1052

Merged
wolveix merged 1 commit into
danielgtaylor:mainfrom
hlavacekvit:fix/case-insensitive-content-type
Jun 29, 2026
Merged

fix: content type validation should be case insensitive#1052
wolveix merged 1 commit into
danielgtaylor:mainfrom
hlavacekvit:fix/case-insensitive-content-type

Conversation

@hlavacekvit

Copy link
Copy Markdown
Contributor

I ran into this in production: an old .NET app couldn't call our Huma-based service because it sends Content-Type: Application/Json (capitalized), and Huma responded with 415 Unsupported Media Type.

Media types are case-insensitive per RFC 9110 §8.3.1, but the format lookup (a.formats[ct]) is a case-sensitive map access, so Application/Json doesn't match the registered application/json.

Fixed by lowercasing the media-type token. Added a test as well

@wolveix
wolveix merged commit 770e618 into danielgtaylor:main Jun 29, 2026
2 checks passed
@wolveix

wolveix commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Awesome find and fix, thanks @hlavacekvit!

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (fd8148e) to head (c9059e8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1052   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          23       23           
  Lines        4918     4919    +1     
=======================================
+ Hits         4582     4583    +1     
  Misses        272      272           
  Partials       64       64           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants