Merge remote-tracking branch 'origin/benvin/pdbmux-source-fact-ast' into benvin/pdbmux-source-fact-fqdn

# Conflicts:
#	source_test.go
This commit is contained in:
2026-10-09 23:55:24 +11:00
6 changed files with 143 additions and 7 deletions
+5
View File
@@ -45,6 +45,8 @@ type fakeBackend struct {
// rawPaths records the still-escaped request paths, so tests can assert an
// MBean name's percent-encoding survived the proxy.
rawPaths []string
// handle, when set, runs first and answers the request itself by returning true.
handle func(w http.ResponseWriter, r *http.Request) bool
}
func newFakeBackend(t *testing.T, nodesBody, factsBody string) *fakeBackend {
@@ -64,6 +66,9 @@ func newFakeBackend(t *testing.T, nodesBody, factsBody string) *fakeBackend {
fb.gotParams[r.URL.Path] = r.URL.Query()
fb.rawPaths = append(fb.rawPaths, r.URL.EscapedPath())
fb.mu.Unlock()
if fb.handle != nil && fb.handle(w, r) {
return
}
if fb.dead {
panic(http.ErrAbortHandler)
}