Lines Matching refs:Header
146 w.Header().Set("Content-Length", "intentional gibberish") // we check that this is deleted
167 if got, haveCL := res.Header["Content-Length"]; haveCL {
265 for i, v := range res.Header["Date"] {
266 res.Header["Date"][i] = strings.Repeat("x", len(v))
328 w.Header().Set("Content-Length", "3")
355 w.Header().Set("Content-Length", "1235")
375 w.Header().Set("Content-Length", "3")
403 w.Header().Set("Content-Length", "3")
420 if ae := r.Header.Get("Accept-Encoding"); ae != "gzip" {
423 w.Header().Set("Content-Encoding", "gzip")
437 fmt.Fprintf(w, "%q", r.Header["Accept-Encoding"])
438 if ae := r.Header.Get("Accept-Encoding"); ae != "" {
480 w.Header()["Content-Type"] = []string{""}
501 w.Header().Set("Got-Length", fmt.Sprint(r.ContentLength))
508 if got, want := res.Header.Get("Got-Length"), fmt.Sprint(wantLen); got != want {
606 req.Trailer = Header{
630 w.Header().Set("Trailer", "Server-Trailer-A, Server-Trailer-B")
631 w.Header().Add("Trailer", "Server-Trailer-C")
639 // with the Trailer header, and then mutate the
640 // Header() of those values later, after the response
642 w.Header().Set("Server-Trailer-A", "valuea")
643 w.Header().Set("Server-Trailer-C", "valuec") // skipping B
644 w.Header().Set("Server-Trailer-NotDeclared", "should be omitted")
653 wantHeader := Header{
670 delete(res.Header, "Date") // irrelevant for test
671 if !reflect.DeepEqual(res.Header, wantHeader) {
672 t.Errorf("Header = %v; want %v", res.Header, wantHeader)
675 if got, want := res.Trailer, (Header{
687 if got, want := res.Trailer, (Header{
756 req.Header.Add("Expect", "100-continue") // just to complicate things
793 Header: Header{},
801 Header: Header{},
834 fmt.Fprintf(w, "%q", r.Header["User-Agent"])
854 func(r *Request) { r.Header.Set("User-Agent", "foo/1.2.3") },
858 func(r *Request) { r.Header["User-Agent"] = []string{"single", "or", "multiple"} },
862 func(r *Request) { r.Header.Set("User-Agent", "") },
866 func(r *Request) { r.Header["User-Agent"] = nil },
898 w.Header().Set("foo", "bar")
912 Header: Header{},
934 if got := res.Header.Get("foo"); got != wantFoo {
935 t.Errorf("response \"foo\" header = %q; want %q", got, wantFoo)
1096 fmt.Fprintf(w, "Handler saw headers: %q", r.Header)
1122 req.Header[tt.key] = []string{tt.val}
1253 h := w.Header()
1285 w.Header().Set("X-Addr", r.RemoteAddr)
1294 v := res.Header.Get("X-Addr")
1343 req.Header.Set("Expect", "100-continue")
1359 w.Header().Set("Foo", "Bar")
1360 w.Header().Set("Trailer:Foo", "Baz")
1362 w.Header().Add("Trailer:Foo", "Baz2")
1363 w.Header().Set("Trailer:Bar", "Quux")
1374 delete(res.Header, "Date")
1375 delete(res.Header, "Content-Type")
1377 if want := (Header{"Foo": {"Bar"}}); !reflect.DeepEqual(res.Header, want) {
1378 t.Errorf("Header = %#v; want %#v", res.Header, want)
1380 if want := (Header{"Foo": {"Baz", "Baz2"}, "Bar": {"Quux"}}); !reflect.DeepEqual(res.Trailer, want) {