MCPcopy
hub / github.com/gofiber/fiber / Test_Client_ConcurrencyRequests

Function Test_Client_ConcurrencyRequests

client/client_test.go:841–865  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

839}
840
841func Test_Client_ConcurrencyRequests(t *testing.T) {
842 t.Parallel()
843
844 app, dial, start := createHelperServer(t)
845 app.All("/", func(c fiber.Ctx) error {
846 return c.SendString(c.Hostname() + " " + c.Method())
847 })
848 go start()
849
850 client := New().SetDial(dial)
851
852 wg := sync.WaitGroup{}
853 for range 5 {
854 for _, method := range []string{"GET", "POST", "PUT", "DELETE", "PATCH"} {
855 m := method
856 wg.Go(func() {
857 resp, err := client.Custom("http://example.com", m)
858 require.NoError(t, err)
859 assert.Equal(t, "example.com "+m, utils.UnsafeString(resp.RawResponse.Body()))
860 })
861 }
862 }
863
864 wg.Wait()
865}
866
867func Test_Get(t *testing.T) {
868 t.Parallel()

Callers

nothing calls this directly

Calls 9

createHelperServerFunction · 0.85
NewFunction · 0.70
AllMethod · 0.65
SendStringMethod · 0.65
HostnameMethod · 0.65
MethodMethod · 0.65
SetDialMethod · 0.65
BodyMethod · 0.65
CustomMethod · 0.45

Tested by

no test coverage detected