Files
marqdo/plugins/web/internal/httpx/helpers_test.go
T
cflmyandCursor 3f96592c99 feat(web): form_load SSR prefill and safe {id} desk routes
Edit pages can stamp compose_form_load to hydrate forms from DB by route id without author JS. Part slots use {part} so pathParamNames can inject {id} again.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-18 12:50:59 +08:00

25 lines
540 B
Go

package httpx
import "testing"
func TestGoMuxPattern(t *testing.T) {
if got := goMuxPattern("/_media/{*key}"); got != "/_media/{key...}" {
t.Fatalf("got %q", got)
}
if got := goMuxPattern("/post/{slug}"); got != "/post/{slug}" {
t.Fatalf("got %q", got)
}
}
func TestPathParamNamesIncludesID(t *testing.T) {
got := pathParamNames("/desk/posts/{id}")
if len(got) != 1 || got[0] != "id" {
t.Fatalf("got %#v", got)
}
got = pathParamNames("/post/{slug}")
if len(got) != 1 || got[0] != "slug" {
t.Fatalf("got %#v", got)
}
}