Skip to content

Commit

Permalink
test: add test in TestResponseReadBodyStream in the case of ErrBodyTo…
Browse files Browse the repository at this point in the history
…oLarge (#1221)
  • Loading branch information
shenfc6 authored Jan 23, 2025
1 parent 240d401 commit 02acf0e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/protocol/http1/resp/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 02acf0e

Please sign in to comment.