package ipcast import ( "bytes" "io/ioutil" "net/http" ) type IpcastService struct { } func (s *IpcastService) Common(url, method string, data []byte) (resp []byte, err error) { c := http.Client{} request, err := http.NewRequest(method, url, bytes.NewBuffer(data)) if err != nil { return nil, err } do, err := c.Do(request) if err != nil { return nil, err } body := do.Body defer body.Close() all, err := ioutil.ReadAll(body) if err != nil { return nil, err } return all, nil }