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

Function Test_Ctx_SendStream

ctx_test.go:8351–8367  ·  view source on GitHub ↗

go test -run Test_Ctx_SendStream

(t *testing.T)

Source from the content-addressed store, hash-verified

8349
8350// go test -run Test_Ctx_SendStream
8351func Test_Ctx_SendStream(t *testing.T) {
8352 t.Parallel()
8353 app := New()
8354 c := app.AcquireCtx(&fasthttp.RequestCtx{})
8355
8356 err := c.SendStream(bytes.NewReader([]byte("Don't crash please")))
8357 require.NoError(t, err)
8358 require.Equal(t, "Don't crash please", string(c.Response().Body()))
8359
8360 err = c.SendStream(bytes.NewReader([]byte("Don't crash please")), len([]byte("Don't crash please")))
8361 require.NoError(t, err)
8362 require.Equal(t, "Don't crash please", string(c.Response().Body()))
8363
8364 err = c.SendStream(bufio.NewReader(bytes.NewReader([]byte("Hello bufio"))))
8365 require.NoError(t, err)
8366 require.Equal(t, "Hello bufio", string(c.Response().Body()))
8367}
8368
8369// go test -run Test_Ctx_SendStreamWriter
8370func Test_Ctx_SendStreamWriter(t *testing.T) {

Callers

nothing calls this directly

Calls 5

AcquireCtxMethod · 0.80
NewFunction · 0.70
SendStreamMethod · 0.65
BodyMethod · 0.65
ResponseMethod · 0.65

Tested by

no test coverage detected