photoprism/pkg/http/safe/helpers_test.go
Michael Mayer df5efb61a2 Backend: Clean up error handling and unit tests in pkg/...
Signed-off-by: Michael Mayer <michael@photoprism.app>
2026-02-09 12:31:29 +01:00

17 lines
321 B
Go

package safe
import (
"net/http"
"net/http/httptest"
"testing"
)
// newTestServer creates an httptest server and closes it automatically via test cleanup.
func newTestServer(t *testing.T, handler http.HandlerFunc) *httptest.Server {
t.Helper()
ts := httptest.NewServer(handler)
t.Cleanup(ts.Close)
return ts
}