gin protobuf客户端测试
// clientGIN project main.go package main import ( "clientGIN/model" "fmt" "io/ioutil" "net/http" "google.golang.org/protobuf/proto" ) func main() { resp, err := http.Post("http://localhost:1234/protobuf/units/select", "application/x-protobuffer", nil) if err != nil { fmt.Println(err) } else { defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err) } else { var dws model.TunitArray proto.Unmarshal(body, &dws) for _, dw := range dws.Tunits { fmt.Println(dw.Unitid, dw.Unitname) } } } }