Rename GetReasonFromBody() to simply Reason()
See ¹ for the customary idiomatic way of naming getters in Go. ¹: https://golang.org/doc/effective_go.html#Getters
This commit is contained in:
@@ -25,9 +25,9 @@ import (
|
||||
"github.com/BBVA/kapow/internal/server/srverrors"
|
||||
)
|
||||
|
||||
// GetReasonFromBody returns the reason phrase embedded within the JSON error
|
||||
// Reason returns the reason phrase embedded within the JSON error
|
||||
// body, or an error if no reason can be extracted
|
||||
func GetReasonFromBody(r *http.Response) (string, error) {
|
||||
func Reason(r *http.Response) (string, error) {
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return "", errors.New("error reading response's body")
|
||||
|
||||
Reference in New Issue
Block a user