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

Function TestFramerWriteReadSettings

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

Source from the content-addressed store, hash-verified

83}
84
85func TestFramerWriteReadSettings(t *testing.T) {
86 var buf bytes.Buffer
87 fw := NewFramer(&buf, nil)
88 fw.WriteSettings(reqhttp2.Setting{ID: reqhttp2.SettingMaxFrameSize, Val: 16384})
89
90 fr := NewFramer(nil, &buf)
91 f, err := fr.ReadFrame()
92 if err != nil {
93 t.Fatalf("ReadFrame failed: %v", err)
94 }
95 sf, ok := f.(*SettingsFrame)
96 if !ok {
97 t.Fatalf("expected *SettingsFrame, got %T", f)
98 }
99 if sf.IsAck() {
100 t.Fatal("should not be ack")
101 }
102 if sf.NumSettings() != 1 {
103 t.Fatalf("NumSettings = %d, want 1", sf.NumSettings())
104 }
105 s := sf.Setting(0)
106 if s.ID != reqhttp2.SettingMaxFrameSize || s.Val != 16384 {
107 t.Fatalf("Setting = %v, want {MaxFrameSize, 16384}", s)
108 }
109}
110
111func TestFramerWriteReadPing(t *testing.T) {
112 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 6

WriteSettingsMethod · 0.95
ReadFrameMethod · 0.95
NewFramerFunction · 0.85
NumSettingsMethod · 0.80
SettingMethod · 0.80
IsAckMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…