Refactor error handling tests to use structured test cases and add address validation in server start method

This commit is contained in:
Andy Oknen 2025-07-30 07:44:44 +00:00
parent 170e369a53
commit 51e1ef3ed0
2 changed files with 43 additions and 31 deletions

View file

@ -2,6 +2,7 @@ package webui
import (
"fmt"
"net"
"net/http"
"time"
@ -22,6 +23,13 @@ func Server(listen string, log core.Logger) *WebUIServer {
}
func (w *WebUIServer) Start() error {
// Validate listen address before starting
if w.listen != "" {
if _, _, err := net.SplitHostPort(w.listen); err != nil {
return fmt.Errorf("invalid listen address: %v", err)
}
}
mux := http.NewServeMux()
// Setup static files handler (implementation varies by build)