Skip to content

Conversation

@karlseguin
Copy link
Collaborator

Synchronous body reader now exposes a peek() function to get the first few bytes from the response body. This will be no less than 100 bytes (assuming the body is that big), but could be more. Streaming API, via res.next() continues to work as-is even if peek() is called.

Introduce Mime.sniff() that detects a few common types - the ones that we care about right now - from the body content.

The original Mime.parse() has also been optimized to take advantage of the fact that the provided content_type is now mutable (went from []const u8 to []u8).

Synchronous body reader now exposes a peek() function to get the first few bytes
from the response body. This will be no less than 100 bytes (assuming the body
is that big), but could be more. Streaming API, via res.next() continues to work
as-is even if peek() is called.

Introduce Mime.sniff() that detects a few common types - the ones that we care
about right now - from the body content.
@krichprollsch krichprollsch merged commit 5a08c92 into main Apr 22, 2025
12 checks passed
@krichprollsch krichprollsch deleted the mime_sniffing branch April 22, 2025 15:25
@github-actions github-actions bot locked and limited conversation to collaborators Apr 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants