Files
godoxy-yusing/internal/route/test_route.go
yusing 9abe948d1d refactor(entrypoint): streamline benchmark tests and enhance error handling
- Introduced `NewTestRoute` function to simplify route creation in benchmark tests.
- Replaced direct route validation and starting with error handling using `require.NoError`.
- Updated server retrieval to use `common.ProxyHTTPAddr` for consistency.
- Improved logging for HTTP route addition errors in `AddRoute` method.
2026-02-06 15:38:22 +08:00

23 lines
370 B
Go

package route
import (
"github.com/yusing/godoxy/internal/types"
"github.com/yusing/goutils/task"
)
func NewTestRoute[T interface{ Helper() }](t T, task task.Parent, base *Route) (types.Route, error) {
t.Helper()
err := base.Validate()
if err != nil {
return nil, err
}
err = base.Start(task)
if err != nil {
return nil, err
}
return base.impl, nil
}