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

Function Test_Utils_TestConn_Closed_Write

helpers_test.go:740–757  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

738}
739
740func Test_Utils_TestConn_Closed_Write(t *testing.T) {
741 t.Parallel()
742 conn := &testConn{}
743
744 // Verify write of response
745 _, err := conn.Write([]byte("Response 1\n"))
746 require.NoError(t, err)
747
748 // Close early, write should fail
749 conn.Close() //nolint:errcheck // It is fine to ignore the error here
750 _, err = conn.Write([]byte("Response 2\n"))
751 require.ErrorIs(t, err, errTestConnClosed)
752
753 res := make([]byte, 11)
754 _, err = conn.w.Read(res)
755 require.NoError(t, err)
756 require.Equal(t, []byte("Response 1\n"), res)
757}
758
759func Test_Utils_IsNoCache(t *testing.T) {
760 t.Parallel()

Callers

nothing calls this directly

Calls 3

WriteMethod · 0.95
CloseMethod · 0.95
ReadMethod · 0.45

Tested by

no test coverage detected