diff --git a/internal/api/router_test.go b/internal/api/router_test.go index 8c2cfb3..513a1c4 100644 --- a/internal/api/router_test.go +++ b/internal/api/router_test.go @@ -780,3 +780,27 @@ func TestCanCapturePublicURL_NilInputs(t *testing.T) { }) } } + +func TestCapturePublicURLFromRequest_NilInputs(t *testing.T) { + t.Parallel() + + t.Run("nil router", func(t *testing.T) { + var r *Router + req := httptest.NewRequest(http.MethodGet, "/", nil) + // Should not panic + r.capturePublicURLFromRequest(req) + }) + + t.Run("nil request", func(t *testing.T) { + r := &Router{config: &config.Config{}} + // Should not panic + r.capturePublicURLFromRequest(nil) + }) + + t.Run("nil config", func(t *testing.T) { + r := &Router{config: nil} + req := httptest.NewRequest(http.MethodGet, "/", nil) + // Should not panic + r.capturePublicURLFromRequest(req) + }) +}