fix: correct response handling edge cases#3855
Open
SisyphusZheng wants to merge 1 commit into
Open
Conversation
Three fixes for HTTP response correctness: 1. HEAD requests: Deno.serve already strips bodies from HEAD responses. The explicit \ ew Response(null, result)\ wrapper was unnecessary and could produce incorrect Content-Length headers (RFC 7231 §4.3.2). Remove the special case and let Deno handle it. 2. Malformed URI params: \decodeURI()\ throws a URIError on malformed percent-encoding (e.g. %GG), causing an uncaught 500 error instead of a proper 400. Wrap in try/catch and fall back to the raw value. 3. DiskBuildCache.readFile(): Replace the \�sync\ + lint-ignore pattern with an explicit \Promise.reject()\ to cleanly signal the intentional not-implemented status.
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.
Three fixes for HTTP response correctness:
HEAD requests: Deno.serve already strips bodies from HEAD responses. The explicit
ew Response(null, result)\ wrapper was unnecessary and could produce incorrect Content-Length headers (RFC 7231 §4.3.2). Remove the special case.
Malformed URI params: \decodeURI()\ throws a URIError on malformed percent-encoding (e.g. %GG), causing an uncaught 500 Internal Server Error. Wrap in try/catch and fall back to the raw value so the handler can respond appropriately.
DiskBuildCache.readFile(): Replace the \�sync\ + \deno-lint-ignore require-await\ pattern with an explicit \Promise.reject(), which is cleaner and signals the intentional not-implemented status without requiring a lint suppression.