Skip to content

Commit e2ad63e

Browse files
committed
🩹 Fix: i/o timout in Test_Proxy_Do_WithRealURL
1 parent ea11d43 commit e2ad63e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

middleware/proxy/proxy_test.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -501,18 +501,24 @@ func Test_Proxy_Do_RestoreOriginalURL(t *testing.T) {
501501
// go test -race -run Test_Proxy_Do_WithRealURL
502502
func Test_Proxy_Do_WithRealURL(t *testing.T) {
503503
t.Parallel()
504+
505+
_, addr := createProxyTestServerIPv4(t, func(c fiber.Ctx) error {
506+
return c.SendString("mock response")
507+
})
508+
504509
app := fiber.New()
505510
app.Get("/test", func(c fiber.Ctx) error {
506-
return Do(c, "https://www.google.com")
511+
return Do(c, "http://"+addr)
507512
})
508513

509-
resp, err1 := app.Test(httptest.NewRequest(fiber.MethodGet, "/test", nil))
510-
require.NoError(t, err1)
514+
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/test", nil))
515+
require.NoError(t, err)
511516
require.Equal(t, fiber.StatusOK, resp.StatusCode)
512517
require.Equal(t, "/test", resp.Request.URL.String())
518+
513519
body, err := io.ReadAll(resp.Body)
514520
require.NoError(t, err)
515-
require.Contains(t, string(body), "https://www.google.com/")
521+
require.Equal(t, "mock response", string(body))
516522
}
517523

518524
// go test -race -run Test_Proxy_Do_WithRedirect

0 commit comments

Comments
 (0)