Skip to content

Fix content-type when no space after semicolon #814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

jonathanberthias
Copy link
Contributor

Currently, the Content-Type header splits the media type from the parameters by looking for ; (a semicolon followed by a space), whereas according to RFC 9110 that space is optional.

This leads to issues when a client sends e.g. application/json;charset=utf-8 which is valid as a Content Type header.

I used the examples from the RFC and made sure they are correctly handled. It isn't a full coverage of the allowed grammar, but hopefully it should cover most use cases.

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 90.26%. Comparing base (9268452) to head (fb0ea95).
Report is 11 commits behind head on master.

Files Patch % Lines
openapi_core/templating/media_types/finders.py 90.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #814      +/-   ##
==========================================
- Coverage   90.26%   90.26%   -0.01%     
==========================================
  Files         147      147              
  Lines        4294     4302       +8     
  Branches      523      524       +1     
==========================================
+ Hits         3876     3883       +7     
  Misses        317      317              
- Partials      101      102       +1     

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

Copy link
Collaborator

@p1c2u p1c2u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@p1c2u
Copy link
Collaborator

p1c2u commented Mar 20, 2024

@jonathanberthias thanks for the contribution.

@p1c2u p1c2u merged commit 32ce657 into python-openapi:master Mar 20, 2024
7 of 9 checks passed
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