-
Notifications
You must be signed in to change notification settings - Fork 0
/
dump.go
34 lines (30 loc) · 863 Bytes
/
dump.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package http2util
// Note: Code is taken from https://cs.opensource.google/go/x/net/+/master:http2
import (
"fmt"
"golang.org/x/net/http2"
)
func Dump(f http2.Frame) (string, error) {
switch f := f.(type) {
case *http2.SettingsFrame:
return fmt.Sprintf("%#v", f), nil
case *http2.MetaHeadersFrame:
return DumpMetaHeaders(f)
case *http2.WindowUpdateFrame:
return fmt.Sprintf("%#v", f), nil
case *http2.PingFrame:
return fmt.Sprintf("%#v", f), nil
case *http2.DataFrame:
return fmt.Sprintf("%#v", f), nil
case *http2.RSTStreamFrame:
return fmt.Sprintf("%#v", f), nil
case *http2.PriorityFrame:
return fmt.Sprintf("%#v", f), nil
case *http2.GoAwayFrame:
return fmt.Sprintf("%#v", f), nil
case *http2.PushPromiseFrame:
return fmt.Sprintf("%#v", f), nil
default:
return "", fmt.Errorf("[Frame2String] unable to handle frame")
}
}