Drop connect and serve-static in favour of native http#170
Merged
Conversation
The test fixture web server only needs to map a request path to a file under test/http-server and stream it back, optionally over http2 with the test certs. A connect pipeline plus serve-static was overkill for that, and was the last reason to depend on a connect middleware stack at all. The replacement is a small handler in test/help/webserver.js: resolve the request path against the fixture root with a normalise/traversal guard, look up a MIME type by extension, pipe the file out. HTTP/2 still wires in the same key/cert pair from test/testdata/certs. Probed against a representative fixture: HTML, image, missing path, directory request — all behave the same as before, with one fewer dependency chain dragged into the install. Co-authored-by: Claude noreply@anthropic.com
2baca24 to
d28f6b7
Compare
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.
The test fixture web server only needs to map a request path to a file under
test/http-server and stream it back, optionally over http2 with the test
certs. A connect pipeline plus serve-static was overkill for that, and was
the last reason to depend on a connect middleware stack at all.
The replacement is a small handler in test/help/webserver.js: resolve the
request path against the fixture root with a normalise/traversal guard, look
up a MIME type by extension, pipe the file out. HTTP/2 still wires in the
same key/cert pair from test/testdata/certs. Probed against a representative
fixture: HTML, image, missing path, directory request — all behave the same
as before, with one fewer dependency chain dragged into the install.
Co-authored-by: Claude noreply@anthropic.com