From f1337f0fb1d31e188614ad3d95659b1b37bd3ea7 Mon Sep 17 00:00:00 2001 From: shenfc Date: Wed, 30 Oct 2024 20:16:08 +0800 Subject: [PATCH] add test int TestResponseReadBodyStream in the case of ErrBodyTooLarge --- pkg/protocol/http1/resp/response_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/protocol/http1/resp/response_test.go b/pkg/protocol/http1/resp/response_test.go index cff0a5783..3c206e47a 100644 --- a/pkg/protocol/http1/resp/response_test.go +++ b/pkg/protocol/http1/resp/response_test.go @@ -780,6 +780,10 @@ func TestResponseReadBodyStream(t *testing.T) { testResponseReadBodyStreamSuccess(t, resp, "HTTP/1.1 300 OK\r\nTransfer-Encoding: chunked\r\nTrailer: Foo\r\nContent-Type: bar\r\n\r\n5\r\n56789\r\n0\r\nfoo: bar\r\n\r\n", consts.StatusMultipleChoices, -1, "bar", "56789", map[string]string{"Foo": "bar"}, consts.HTTP11) + bodyWithLongLength := strings.Repeat("1", 8*1024+1) + testResponseReadBodyStreamSuccess(t, resp, "HTTP/1.1 200 OK\r\nContent-Length: 8193\r\nContent-Type: foo/bar\r\n\r\n"+bodyWithLongLength, + consts.StatusOK, 8193, "foo/bar", bodyWithLongLength, nil, consts.HTTP11) + // response with trailer disableNormalizing resp.Header.DisableNormalizing() resp.Header.Trailer().DisableNormalizing()