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

Function Test_Client_Logger_DisableDebug

client/hooks_test.go:723–757  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

721}
722
723func Test_Client_Logger_DisableDebug(t *testing.T) {
724 t.Parallel()
725 app := fiber.New()
726 app.Get("/", func(c fiber.Ctx) error {
727 return c.SendString("response")
728 })
729
730 addrChan := make(chan string)
731 go func() {
732 assert.NoError(t, app.Listen(":0", fiber.ListenConfig{
733 DisableStartupMessage: true,
734 ListenerAddrFunc: func(addr net.Addr) {
735 addrChan <- addr.String()
736 },
737 }))
738 }()
739
740 defer func(app *fiber.App) {
741 require.NoError(t, app.Shutdown())
742 }(app)
743
744 var buf bytes.Buffer
745 logger := &dummyLogger{buf: &buf}
746
747 client := New()
748 client.DisableDebug().SetLogger(logger)
749
750 addr := <-addrChan
751 resp, err := client.Get("http://" + addr)
752 require.NoError(t, err)
753 defer resp.Close()
754
755 require.NoError(t, err)
756 require.Empty(t, buf.String())
757}
758
759func Benchmark_Parser_Request_Body_File(b *testing.B) {
760 b.Helper()

Callers

nothing calls this directly

Calls 11

StringMethod · 0.95
ListenMethod · 0.80
ShutdownMethod · 0.80
SetLoggerMethod · 0.80
DisableDebugMethod · 0.80
NewFunction · 0.70
NewMethod · 0.65
GetMethod · 0.65
SendStringMethod · 0.65
StringMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected