mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-18 00:59:38 +00:00
17 lines
321 B
Go
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
|
|
}
|