From 80eea3c886699cd113812b7ddc7774b69900d94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Abdelkader=20Mart=C3=ADnez=20P=C3=A9rez?= Date: Thu, 3 Oct 2019 14:17:24 +0200 Subject: [PATCH] Documentation and better naming --- internal/http/reason.go | 1 + internal/http/reason_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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")