aboutsummaryrefslogtreecommitdiff
path: root/http_test.go
diff options
context:
space:
mode:
authorGravatar byene0923 <34917110+byene0923@users.noreply.github.com> 2022-10-30 00:32:08 +0800
committerGravatar GitHub <noreply@github.com> 2022-10-29 18:32:08 +0200
commite2141372b6f9007fe964cf8355852e8843fbbf2c (patch)
tree8e6f99a10e0d64db05d88695ef8af0030a14df9c /http_test.go
parentoptimize: adjust the behavior of PeekAll based on VisitAll (#1403) (diff)
downloadfasthttp-e2141372b6f9007fe964cf8355852e8843fbbf2c.tar.gz
fasthttp-e2141372b6f9007fe964cf8355852e8843fbbf2c.tar.bz2
fasthttp-e2141372b6f9007fe964cf8355852e8843fbbf2c.zip
fix: ignore body should not set content-length of streaming (#1406)
* fix: ignore body should not set content-length of streaming https://github.com/valyala/fasthttp/pull/1022 * fix: add commit
Diffstat (limited to 'http_test.go')
-rw-r--r--http_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/http_test.go b/http_test.go
index 58bc8cb..4e16f05 100644
--- a/http_test.go
+++ b/http_test.go
@@ -1053,6 +1053,25 @@ func TestRequestReadNoBody(t *testing.T) {
}
}
+func TestRequestReadNoBodyStreaming(t *testing.T) {
+ t.Parallel()
+
+ var r Request
+
+ r.Header.contentLength = -2
+
+ br := bufio.NewReader(bytes.NewBufferString("GET / HTTP/1.1\r\n\r\n"))
+ err := r.ContinueReadBodyStream(br, 0)
+ r.SetHost("foobar")
+ if err != nil {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ s := r.String()
+ if strings.Contains(s, "Content-Length: ") {
+ t.Fatalf("unexpected Content-Length")
+ }
+}
+
func TestResponseWriteTo(t *testing.T) {
t.Parallel()