go test -race -run Test_Proxy_Forward_Local_Client
(t *testing.T)
| 807 | |
| 808 | // go test -race -run Test_Proxy_Forward_Local_Client |
| 809 | func Test_Proxy_Forward_Local_Client(t *testing.T) { |
| 810 | t.Parallel() |
| 811 | ln, err := net.Listen(fiber.NetworkTCP4, "127.0.0.1:0") |
| 812 | require.NoError(t, err) |
| 813 | app := fiber.New() |
| 814 | app.Get("/test_local_client", func(c fiber.Ctx) error { |
| 815 | return c.SendString("test_local_client") |
| 816 | }) |
| 817 | |
| 818 | addr := ln.Addr().String() |
| 819 | app.Use(Forward("http://"+addr+"/test_local_client", &fasthttp.Client{ |
| 820 | NoDefaultUserAgentHeader: true, |
| 821 | DisablePathNormalizing: true, |
| 822 | |
| 823 | Dial: fasthttp.Dial, |
| 824 | })) |
| 825 | startServer(app, ln) |
| 826 | |
| 827 | client := clientpkg.New() |
| 828 | resp, err := client.Get("http://" + addr) |
| 829 | require.NoError(t, err) |
| 830 | require.Equal(t, fiber.StatusOK, resp.StatusCode()) |
| 831 | require.Equal(t, "test_local_client", string(resp.Body())) |
| 832 | resp.Close() |
| 833 | } |
| 834 | |
| 835 | // go test -run Test_Proxy_WithClient_Nil_Panics |
| 836 | func Test_Proxy_WithClient_Nil_Panics(t *testing.T) { |
nothing calls this directly
no test coverage detected