Skip to content

Fix media and content type #509

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

JordonPhillips
Copy link
Contributor

This updates media type serialization to pick up all the proper cases, including omitting media type if there's no body. It also introduces content-length serialization.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@JordonPhillips JordonPhillips requested a review from a team as a code owner June 4, 2025 15:35
Base automatically changed from centralize-http-binding-matching to develop June 5, 2025 10:06
@JordonPhillips JordonPhillips force-pushed the fix-media-and-content-type branch from 1c44b80 to 963ed7d Compare June 5, 2025 10:10
Comment on lines +196 to +200
def _compute_content_length(self, payload: Any) -> int | None:
content_length = self._seek(payload, 0, 2)
if content_length is not None:
self._seek(payload, 0, 0)
return content_length
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a vector for data corruption right? If you get a partially read stream, we can't seek back to beginning. We'd want to use tell to check our current position before reading to the end or take the length and seek in reverse from the end. I think that's potentially going to have issues with length of bytes vs characters though.

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