diff options
author | kinggo <lilong.21@bytedance.com> | 2022-10-22 18:04:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 12:04:46 +0200 |
commit | 128e9b35c48610a2c23c5ed56a8a2c413fd43609 (patch) | |
tree | d588da5c85585ec495579f2069317c41f59bec38 /header_test.go | |
parent | feat: add header.PeekAll (#1394) (diff) | |
download | fasthttp-128e9b35c48610a2c23c5ed56a8a2c413fd43609.tar.gz fasthttp-128e9b35c48610a2c23c5ed56a8a2c413fd43609.tar.bz2 fasthttp-128e9b35c48610a2c23c5ed56a8a2c413fd43609.zip |
Diffstat (limited to 'header_test.go')
-rw-r--r-- | header_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/header_test.go b/header_test.go index 643e8f3..fdefc3c 100644 --- a/header_test.go +++ b/header_test.go @@ -2883,6 +2883,13 @@ func TestRequestHeader_PeekAll(t *testing.T) { expectRequestHeaderAll(t, h, "Cookie", [][]byte{s2b("foobar=baz")}) expectRequestHeaderAll(t, h, HeaderTrailer, [][]byte{s2b("Foo, Bar")}) expectRequestHeaderAll(t, h, "aaa", [][]byte{s2b("aaa"), s2b("bbb")}) + + h.Del("Content-Type") + h.Del(HeaderHost) + h.Del("aaa") + expectRequestHeaderAll(t, h, "Content-Type", [][]byte{}) + expectRequestHeaderAll(t, h, HeaderHost, [][]byte{}) + expectRequestHeaderAll(t, h, "aaa", [][]byte{}) } func expectRequestHeaderAll(t *testing.T, h *RequestHeader, key string, expectedValue [][]byte) { if len(h.PeekAll(key)) != len(expectedValue) { @@ -2913,6 +2920,11 @@ func TestResponseHeader_PeekAll(t *testing.T) { expectResponseHeaderAll(t, h, HeaderServer, [][]byte{s2b("aaaa")}) expectResponseHeaderAll(t, h, HeaderSetCookie, [][]byte{s2b("cccc")}) expectResponseHeaderAll(t, h, "aaa", [][]byte{s2b("aaa"), s2b("bbb")}) + + h.Del(HeaderContentType) + h.Del(HeaderContentEncoding) + expectResponseHeaderAll(t, h, HeaderContentType, [][]byte{defaultContentType}) + expectResponseHeaderAll(t, h, HeaderContentEncoding, [][]byte{}) } func expectResponseHeaderAll(t *testing.T, h *ResponseHeader, key string, expectedValue [][]byte) { |