1919
2020func testTarget (t testing.TB , handler http.HandlerFunc ) * Target {
2121 t .Helper ()
22+
2223 _ , targetURL := testBackendWithHandler (t , handler )
2324
2425 target , err := NewTarget (targetURL , defaultTargetOptions )
@@ -28,6 +29,7 @@ func testTarget(t testing.TB, handler http.HandlerFunc) *Target {
2829
2930func testTargetWithOptions (t testing.TB , targetOptions TargetOptions , handler http.HandlerFunc ) * Target {
3031 t .Helper ()
32+
3133 _ , targetURL := testBackendWithHandler (t , handler )
3234
3335 target , err := NewTarget (targetURL , targetOptions )
@@ -37,6 +39,7 @@ func testTargetWithOptions(t testing.TB, targetOptions TargetOptions, handler ht
3739
3840func testBackend (t testing.TB , body string , statusCode int ) (* httptest.Server , string ) {
3941 t .Helper ()
42+
4043 return testBackendWithHandler (t , func (w http.ResponseWriter , r * http.Request ) {
4144 w .WriteHeader (statusCode )
4245 w .Write ([]byte (body ))
@@ -45,6 +48,7 @@ func testBackend(t testing.TB, body string, statusCode int) (*httptest.Server, s
4548
4649func testBackendWithHandler (t testing.TB , handler http.HandlerFunc ) (* httptest.Server , string ) {
4750 t .Helper ()
51+
4852 server := httptest .NewServer (handler )
4953 t .Cleanup (server .Close )
5054
@@ -56,6 +60,7 @@ func testBackendWithHandler(t testing.TB, handler http.HandlerFunc) (*httptest.S
5660
5761func testServer (t testing.TB ) (* Server , string ) {
5862 t .Helper ()
63+
5964 config := & Config {
6065 Bind : "127.0.0.1" ,
6166 HttpPort : 0 ,
0 commit comments