MCPcopy Create free account
hub / github.com/imroc/req / TestFramerWriteReadPing

Function TestFramerWriteReadPing

internal/http2/frame_test.go:111–132  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

109}
110
111func TestFramerWriteReadPing(t *testing.T) {
112 var buf bytes.Buffer
113 fw := NewFramer(&buf, nil)
114 data := [8]byte{1, 2, 3, 4, 5, 6, 7, 8}
115 fw.WritePing(false, data)
116
117 fr := NewFramer(nil, &buf)
118 f, err := fr.ReadFrame()
119 if err != nil {
120 t.Fatalf("ReadFrame failed: %v", err)
121 }
122 pf, ok := f.(*PingFrame)
123 if !ok {
124 t.Fatalf("expected *PingFrame, got %T", f)
125 }
126 if pf.IsAck() {
127 t.Fatal("should not be ack")
128 }
129 if pf.Data != data {
130 t.Fatalf("Data = %v, want %v", pf.Data, data)
131 }
132}
133
134func TestFramerWriteReadWindowUpdate(t *testing.T) {
135 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 4

WritePingMethod · 0.95
ReadFrameMethod · 0.95
NewFramerFunction · 0.85
IsAckMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…