examples: drop redundant WithPermissiveOriginCheck in dev branches (#483) - #107
Merged
Conversation
…483) WithDevMode(true) already relaxes the WebSocket origin check to allow all origins (see livetemplate#487), so pairing it with WithPermissiveOriginCheck() in the dev branch is redundant. Collapse every example's dev branch to a single WithDevMode(true) call with a comment noting it also relaxes the origin check — so a reader copying the example sees the minimal, correct dev setup. Also drop the redundant paired call from the two test files that built their own options (live-dashboard, redacted-form), and refresh the four handler.go "test-server callers" comments + cmd/site's to describe the mechanism as running in dev mode (which relaxes the origin check) rather than supplying WithPermissiveOriginCheck. Those comments also cited stale e2e paths (docs/e2e/login, docs/e2e/patterns/main.go) that no longer exist — the real test-server callers are the examples' own _test.go files, which run the app with LVT_DEV_MODE=true via e2etest.StartTestServer. Relies only on already-released livetemplate v0.18.0 runtime behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ZgmyffUen38oazb39RhSk
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.
What & why
Companion to livetemplate#487.
WithDevMode(true)already relaxes the WebSocket origin check to allow all origins, so pairing it withWithPermissiveOriginCheck()in every example's dev branch is redundant. This drops the extra call.Relies only on already-released v0.18.0 runtime behavior (the docs repo already pins it), so it's independent of the core doc/test PR.
Changes
cmd/main.go: collapse theif *dev { … }branch from a two-callappend(WithDevMode(true), WithPermissiveOriginCheck())to a singleWithDevMode(true), with a one-line comment noting dev mode also relaxes the origin check — so a reader copying the example sees the minimal, correct dev setup.live-dashboard/dashboard_test.go,redacted-form/redacted_form_test.go): same redundant pairing in test-built options — dropped.handler.gocomments +cmd/site/main.go: rewrote the "test-server callers" notes to describe the mechanism as running in dev mode (which relaxes the origin check) instead of supplyingWithPermissiveOriginCheck. These also cited stale e2e paths (docs/e2e/login,docs/e2e/patterns/main.go) that no longer exist — the real callers are the examples' own_test.gofiles, which launch the app withLVT_DEV_MODE=trueviae2etest.StartTestServer.Verification
go build ./examples/... ./cmd/...green; all touched files gofmt-clean.WithPermissiveOriginCheckreferences.live-dashboard,redacted-form,shared-notepad,todosall pass. The WS upgrade succeeds on a random localhost port in a real browser withWithDevMode(true)alone — e.g. live-dashboard's two-tabs-one-goroutine refresh works overlocalhost:39817.🤖 Generated with Claude Code