added create channel functions.

This commit is contained in:
5elenay
2021-08-24 09:02:03 +03:00
parent 9b70f7e4cd
commit b527ca2758
3 changed files with 52 additions and 12 deletions

View File

@@ -27,10 +27,6 @@ func (c Client) Request(method, path string, data []byte) ([]byte, error) {
return []byte{}, err
}
if !(resp.StatusCode >= 200 && resp.StatusCode < 300) {
return []byte{}, fmt.Errorf(resp.Status)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
@@ -38,5 +34,9 @@ func (c Client) Request(method, path string, data []byte) ([]byte, error) {
return []byte{}, err
}
if !(resp.StatusCode >= 200 && resp.StatusCode < 300) {
return []byte{}, fmt.Errorf("%s: %s", resp.Status, body)
}
return body, nil
}