MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestMemoryReader_Body

Function TestMemoryReader_Body

internal/caches/reader_memory_test.go:23–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestMemoryReader_Body(t *testing.T) {
24 item := &MemoryItem{
25 ExpiresAt: 0,
26 HeaderValue: nil,
27 BodyValue: []byte("0123456789"),
28 Status: 2000,
29 }
30 reader := NewMemoryReader(item)
31 buf := make([]byte, 6)
32 err := reader.ReadBody(buf, func(n int) (goNext bool, err error) {
33 t.Log("buf:", string(buf[:n]))
34 return true, nil
35 })
36 if err != nil {
37 t.Fatal(err)
38 }
39}
40
41func TestMemoryReader_Body_Range(t *testing.T) {
42 item := &MemoryItem{

Callers

nothing calls this directly

Calls 3

ReadBodyMethod · 0.95
NewMemoryReaderFunction · 0.85
LogMethod · 0.80

Tested by

no test coverage detected