Repository navigation
fix(listen): join the forwarding URL path and the event path with a single slash - #478
Open
pcbeingused333 wants to merge 5 commits into
Open
pcbeingused333 wants to merge 5 commits into
pcbeingused333 wants to merge 5 commits into
Conversation
…ingle slash Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
|
Hi, friendly ping on this one when you have a moment. Happy to adjust anything or rebase if needed. Thanks for maintaining the project! |
The request URL was joined with a single slash, but the URL printed in the compact and interactive output, the TUI event details and the TUI connection header was still concatenated by hand. A forwarding URL ending in / therefore printed /base//webhook for a request sent to /base/webhook, and the TUI details and header dropped the forwarding URL's path altogether. Move the join into pkg/listen/forwardurl and use it at all five places, with one test per place. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…L is dropped Whether the query string should be forwarded or rejected is undecided (see hookdeck#475), so the forwardurl test should not pin the current behaviour. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Collaborator
|
Thanks for this, and sorry for the wait. The fix to the forwarded request looks right, and the new test fails on main in exactly the While checking it I found the same
I merged |
The compact startup banner built its "Forwards to" URL from the scheme and host only, so it left out the forwarding URL's path and could disagree with the URL the request is sent to. Build it with pkg/listen/forwardurl like the other places that print the forwarded URL. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fixes #475.
processAttemptbuilds the forwarded URL ascfg.URL.Path + webhookEvent.Body.Path, so a forwarding URL whose path ends in/(hookdeck listen http://127.0.0.1:47913/base/ <source>) sends every request to/base//webhookinstead of/base/webhook.The two paths are now joined by
joinForwardPath, which drops one trailing/from the forwarding URL's path when the event path starts with/. The event path is otherwise kept as is, since a receiver may route on its own trailing slash (which is whypath.Joinis not used), and an empty event path still forwards to the forwarding URL's path unchanged.forward_path_test.goruns one attempt throughprocessAttemptagainst a local server for six cases: forwarding path with and without a trailing slash, the root, no path, an event path with its own trailing slash, and an empty event path. On master the three cases whose forwarding path ends in/(/base/,/and an event path with its own trailing slash) fail with//; with this change all six pass.go vet ./...passes.go test ./...passes apart from two tests in packages this change does not touch, which fail the same way on master in the container used:TestCheckServerHealth_DefaultPorts/HTTPS_default_port(needs an outbound connection to port 443) andTestLogin_rejectedKeyHeadlessFailsFastinpkg/login. The acceptance tests were not run.The issue also notes that a query string on the forwarding URL is dropped; that is not changed here, since forwarding it or rejecting it at startup is a behaviour choice.
This change was prepared with Claude Code.