MSP-8974 fix tests

This commit is contained in:
chashintv committed 2026-11-23 12:58:04 +03:00
1 parent 71498785ea
commit fa8bc6c1b7
50 files changed
+392 -2975

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
package httpt
import (
"net/http"
"net/http/httptest"
"github.com/txix-open/isp-kit/http/httpcli"
"github.com/txix-open/isp-kit/http/httpclix"
"github.com/txix-open/isp-kit/test"
)
// TestServer creates and starts an HTTP test server with the provided handler,
// returning both the server and a configured client. The server listens on
// a random local port and the client is pre-configured with the server's URL.
func TestServer(t *test.Test, handler http.Handler, opts ...httpcli.Option) (*httptest.Server, *httpcli.Client) {
srv := httptest.NewServer(handler)
cli := httpclix.Default(opts...)
cli.GlobalRequestConfig().BaseUrl = srv.URL
return srv, cli
}