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:
pancho horrillo
2019-11-20 05:04:10 +01:00
parent 3a47b34bc1
commit 75b0908b16
3 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -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")