diff --git a/internal/http/reason.go b/internal/http/reason.go index 458adf9..d5b67e1 100644 --- a/internal/http/reason.go +++ b/internal/http/reason.go @@ -5,6 +5,7 @@ import ( "strings" ) +// GetReason returns the reason phrase part of an HTTP response func GetReason(r *http.Response) string { if i := strings.IndexByte(r.Status, ' '); i != -1 { return r.Status[i+1:] diff --git a/internal/http/reason_test.go b/internal/http/reason_test.go index 42d6388..90c1ef0 100644 --- a/internal/http/reason_test.go +++ b/internal/http/reason_test.go @@ -40,7 +40,7 @@ func TestReasonOfMultipleWords(t *testing.T) { } } -func TestOddSizeStatusCode(t *testing.T) { +func TestBehaveWithOddSizeStatusCode(t *testing.T) { r := &nethttp.Response{Status: "2 FOO BAR BAZ"} if GetReason(r) != "FOO BAR BAZ" { t.Errorf("Unexpected reason found")