aboutsummaryrefslogtreecommitdiff
path: root/http_test.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-01-06 19:18:12 +0100
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2021-01-06 19:18:12 +0100
commit70e00dc4f3b8c1ac01a2e82410c9f4d59248c099 (patch)
tree9af55b15f1ec9198953552222a68803c4614794a /http_test.go
parentUse QueryString while constructing RequestURI instead of QueryArgs if parsedQ... (diff)
downloadfasthttp-70e00dc4f3b8c1ac01a2e82410c9f4d59248c099.tar.gz
fasthttp-70e00dc4f3b8c1ac01a2e82410c9f4d59248c099.tar.bz2
fasthttp-70e00dc4f3b8c1ac01a2e82410c9f4d59248c099.zip
Ignore empty Transfer-Encoding headers
Don't default to chunked. If we have a Content-Length header we have a fixed body.
Diffstat (limited to 'http_test.go')
-rw-r--r--http_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/http_test.go b/http_test.go
index 2f91e34..7d02bb5 100644
--- a/http_test.go
+++ b/http_test.go
@@ -16,6 +16,22 @@ import (
"github.com/valyala/bytebufferpool"
)
+func TestResponseEmptyTransferEncoding(t *testing.T) {
+ t.Parallel()
+
+ var r Response
+
+ body := "Some body"
+ br := bufio.NewReader(bytes.NewBufferString("HTTP/1.1 200 OK\r\nContent-Type: aaa\r\nTransfer-Encoding: \r\nContent-Length: 9\r\n\r\n" + body))
+ err := r.Read(br)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got := string(r.Body()); got != body {
+ t.Fatalf("expected %q got %q", body, got)
+ }
+}
+
// Don't send the fragment/hash/# part of a URL to the server.
func TestFragmentInURIRequest(t *testing.T) {
var req Request