api/v2: use SaaS's text for an unknown device

This commit is contained in:
Kristoffer Dalby committed 2026-11-03 17:05:00 +01:00
1 parent e99d8f3f88
commit 9841280d11
2 files changed
+10 -2

No files matched your search

+1 -1
View File
@@ -408,7 +408,7 @@ func lookupNode(b Backend, rawID string) (types.NodeView, error) {
node, ok := b.State.GetNodeByID(nodeID)
if !ok {
return types.NodeView{}, huma.Error404NotFound("device not found")
return types.NodeView{}, huma.Error404NotFound("no manageable device matching this ID found")
}
return node, nil
@@ -1152,7 +1152,8 @@ func registerFlags(attempts []testcapture.RegisterAttempt) string {
}
// answerChecks compares the status of each admin exchange headscale
// answered in the step, keyed by the action's index.
// answered in the step, and the text of a not found, keyed by the action's
// index.
func (r *stepReplay) answerChecks(step testcapture.Step) []stepCheck {
checks := make([]stepCheck, 0, len(r.answers))
@@ -1161,6 +1162,13 @@ func (r *stepReplay) answerChecks(step testcapture.Step) []stepCheck {
checks = append(checks, stepCheck{strconv.Itoa(i) + "/status", strconv.Itoa(step.Actions[i].Status), func() string {
return got
}})
if step.Actions[i].Status == http.StatusNotFound {
text := errorMessage(r.answers[i].body)
checks = append(checks, stepCheck{strconv.Itoa(i) + "/not-found-text", errorMessage(step.Actions[i].Response), func() string {
return text
}})
}
}
return checks