fix: support relative container fetch URLs - #238
Open
badmuriss wants to merge 1 commit into
Open
Conversation
badmuriss
marked this pull request as ready for review
August 11, 2026 13:05
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.
Summary
RequestinputsWhy
containerFetch('/api/data')is documented as supported, but the URL overload passed the relative path directly to theRequestconstructor. SinceRequestrequires an absolute URL when no environment origin exists, the call failed withTypeError: Failed to parse URL from /api/databefore reaching the container.The URL overload now resolves its input against
http://container. This supplies the origin required byRequestwhile the existing TCP port fetch continues to route the request to the selected container port.Fixes #28.
Testing
npm run typechecknpm run typecheck:allnpm run test:unitnpm run lintnpm run format:checknpx changeset statusI also attempted
npm run test. The local integration suite could not start its test containers and timed out in workerd withkj/timer.c++: overloaded: operation timed out, including the existing startup and HTTP fetch cases. The unit regression for this change passes.