github.com/icyphox/x@v0.0.355-0.20220311094250-029bd783e8b8/httpx/assert.go (about) 1 package httpx 2 3 import ( 4 "net/http" 5 ) 6 7 func GetResponseMeta(w http.ResponseWriter) (status, size int) { 8 switch t := w.(type) { 9 case interface{ Status() int }: 10 status = t.Status() 11 } 12 13 switch t := w.(type) { 14 case interface{ Size() int }: 15 size = t.Size() 16 case interface{ Written() int64 }: 17 size = int(t.Written()) 18 } 19 20 return 21 }