]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: add a test verifying header case preservation
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 11 Mar 2013 18:10:43 +0000 (11:10 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 11 Mar 2013 18:10:43 +0000 (11:10 -0700)
Fixes #5022

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7712043

src/pkg/net/http/requestwrite_test.go

index f78d3882a8f2c297a2a588cd229c3e7d2eae0b09..b27b1f7ce3b7d0915744231d62e4d2d5db32f5df 100644 (file)
@@ -391,6 +391,30 @@ var reqWriteTests = []reqWriteTest{
                        "Host: x.google.com\r\n" +
                        "User-Agent: Go 1.1 package http\r\n\r\n",
        },
+
+       // Testing custom case in header keys. Issue 5022.
+       {
+               Req: Request{
+                       Method: "GET",
+                       URL: &url.URL{
+                               Scheme: "http",
+                               Host:   "www.google.com",
+                               Path:   "/",
+                       },
+                       Proto:      "HTTP/1.1",
+                       ProtoMajor: 1,
+                       ProtoMinor: 1,
+                       Header: Header{
+                               "ALL-CAPS": {"x"},
+                       },
+               },
+
+               WantWrite: "GET / HTTP/1.1\r\n" +
+                       "Host: www.google.com\r\n" +
+                       "User-Agent: Go 1.1 package http\r\n" +
+                       "ALL-CAPS: x\r\n" +
+                       "\r\n",
+       },
 }
 
 func TestRequestWrite(t *testing.T) {