diff options
author | Valentin Paz Marcolla <valchulen.pm@gmail.com> | 2021-10-22 12:53:35 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-22 17:53:35 +0200 |
commit | 556aa814e4d862f33c875cf9f0ebdf2867005092 (patch) | |
tree | d64d156edb7c11619e7846526134fb5250f74117 /header_test.go | |
parent | feat: make public Server.TLSConfig (#1128) (diff) | |
download | fasthttp-556aa814e4d862f33c875cf9f0ebdf2867005092.tar.gz fasthttp-556aa814e4d862f33c875cf9f0ebdf2867005092.tar.bz2 fasthttp-556aa814e4d862f33c875cf9f0ebdf2867005092.zip |
feat: ability to edit status messages (#1126)
* SetStatusMessage
* Docstring
* statusLine in header
* Use statusLine as []byte + ResponseHeader parsing
* status line getter
Diffstat (limited to 'header_test.go')
-rw-r--r-- | header_test.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/header_test.go b/header_test.go index 575fae4..19138ad 100644 --- a/header_test.go +++ b/header_test.go @@ -36,7 +36,7 @@ func TestResponseHeaderAddContentType(t *testing.T) { func TestResponseHeaderMultiLineValue(t *testing.T) { t.Parallel() - s := "HTTP/1.1 200 OK\r\n" + + s := "HTTP/1.1 200 SuperOK\r\n" + "EmptyValue1:\r\n" + "Content-Type: foo/bar;\r\n\tnewline;\r\n another/newline\r\n" + "Foo: Bar\r\n" + @@ -52,6 +52,10 @@ func TestResponseHeaderMultiLineValue(t *testing.T) { t.Fatalf("parse response using net/http failed, %s", err) } + if !bytes.Equal(header.StatusLine(), []byte("SuperOK")) { + t.Errorf("parse status line with non-default value failed, got: %s want: SuperOK", header.StatusLine()) + } + for name, vals := range response.Header { got := string(header.Peek(name)) want := vals[0] @@ -78,6 +82,10 @@ func TestResponseHeaderMultiLineName(t *testing.T) { }) t.Errorf("expected error, got %q (%v)", m, err) } + + if !bytes.Equal(header.StatusLine(), []byte("OK")) { + t.Errorf("expected default status line, got: %s", header.StatusLine()) + } } func TestResponseHeaderMultiLinePaniced(t *testing.T) { |