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 /http_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 'http_test.go')
-rw-r--r-- | http_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/http_test.go b/http_test.go index 0e76a10..8d57bb0 100644 --- a/http_test.go +++ b/http_test.go @@ -837,6 +837,24 @@ func TestResponseSkipBody(t *testing.T) { t.Fatalf("unexpected content-type in response %q", s) } + // set StatusNoContent with statusLine + r.Header.SetStatusCode(StatusNoContent) + r.Header.SetStatusLine([]byte("HTTP/1.1 204 NC\r\n")) + r.SetBodyString("foobar") + s = r.String() + if strings.Contains(s, "\r\n\r\nfoobar") { + t.Fatalf("unexpected non-zero body in response %q", s) + } + if strings.Contains(s, "Content-Length: ") { + t.Fatalf("unexpected content-length in response %q", s) + } + if strings.Contains(s, "Content-Type: ") { + t.Fatalf("unexpected content-type in response %q", s) + } + if !strings.HasPrefix(s, "HTTP/1.1 204 NC\r\n") { + t.Fatalf("expecting non-default status line in response %q", s) + } + // explicitly skip body r.Header.SetStatusCode(StatusOK) r.SkipBody = true |