Repository navigation
Conversation
Route and ScreenshotUtils required 'mime/types' at load time, so every `require 'playwright'` paid for the whole MIME database even though it is only consulted by `Route#fulfill(path:)` and by screenshots given a `path:` without a `type:`. Requiring it inside those two methods, as playwright.rb already does for the WebSocket transport, cuts `require 'playwright'` from about 215k to 80k allocated objects and about 3.8 MB of RSS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… type MIME::Types.type_for returns an empty array for an unknown extension, and nil.to_s is an empty string, which is truthy: route.fulfill(path:) sent an empty content-type instead of the intended fallback.
|
@czj is attempting to deploy a commit to the Yusuke Iwaki's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi again! While working on #399 I noticed that
Route#mime_type_fornever reaches its fallback:MIME::Types.type_forreturns an empty array for an unknown extension, andnil.to_sis"", which is truthy in Ruby. Soroute.fulfill(path: "payload.unknownext")ends up sending an emptycontent-typeheader instead ofapplication/octet-stream.This PR adds the missing
&.and a small spec covering both the known-extension case and the fallback (it fails without the fix,got: "").It's stacked on top of #399, since both touch the same method: until that one lands, the diff here also shows its commit, so only the last commit (
Fall back to application/octet-stream…) is new. Once #399 is merged I'll rebase so this becomes a one-liner. And if you'd rather have it folded into #399, or applied onmaindirectly, just tell me and I'll do it that way.Thanks again for the gem!
🤖 Generated with Claude Code, but prompted, read, and verified by @czj, a caring human :)