summaryrefslogtreecommitdiff
path: root/src/net/http/internal/chunked_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/http/internal/chunked_test.go')
-rw-r--r--src/net/http/internal/chunked_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/net/http/internal/chunked_test.go b/src/net/http/internal/chunked_test.go
index ebc626ea9d..7c1c91662f 100644
--- a/src/net/http/internal/chunked_test.go
+++ b/src/net/http/internal/chunked_test.go
@@ -154,3 +154,18 @@ func TestParseHexUint(t *testing.T) {
t.Error("expected error on bogus input")
}
}
+
+func TestChunkReadingIgnoresExtensions(t *testing.T) {
+ in := "7;ext=\"some quoted string\"\r\n" + // token=quoted string
+ "hello, \r\n" +
+ "17;someext\r\n" + // token without value
+ "world! 0123456789abcdef\r\n" +
+ "0;someextension=sometoken\r\n" // token=token
+ data, err := ioutil.ReadAll(NewChunkedReader(strings.NewReader(in)))
+ if err != nil {
+ t.Fatalf("ReadAll = %q, %v", data, err)
+ }
+ if g, e := string(data), "hello, world! 0123456789abcdef"; g != e {
+ t.Errorf("read %q; want %q", g, e)
+ }
+}