3
0
Files
corteza/rbac/util.go
2018-08-16 18:49:18 +02:00

16 lines
305 B
Go

package rbac
import (
"github.com/pkg/errors"
"io/ioutil"
"net/http"
)
func toError(resp *http.Response) error {
body, err := ioutil.ReadAll(resp.Body)
if body == nil || err != nil {
return errors.Errorf("unexpected response (%d, %s)", resp.StatusCode, err)
}
return errors.New(string(body))
}