refactor/webui: hoist duplicated route and header literals into constants #74
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/webui-literal-constants"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #66, part of the SonarQube cleanup in #73. Sonar rule go:S1192 flagged internal/webui/webui.go for the route string /rules repeated 28 times, /requests 12 times, the Content-Type header name and the text/html charset value 4 times each, and the message invalid rule index 5 times. This adds an unexported constant block near the top of webui.go and uses it at every site, including the mux.HandleFunc patterns, redirects and the safe-next fallback, so route registration and redirects share one spelling. api.go uses the header-name constant for its application/json header. Behaviour-neutral, no rendered output, status code or route changes. Templates are untouched, they are #68. One small table-driven test pins the five constant values since no existing test asserted the header value or the error text. All gates pass and the existing webui tests are unchanged. 🤖 Generated with Claude Code