From 387a0832558f3bb2387e789d273edbd96785aae6 Mon Sep 17 00:00:00 2001 From: spacewander Date: Sat, 8 Jul 2017 11:53:34 +0800 Subject: [PATCH] gzip,mime: show response header instead of the request one in test message --- caddyhttp/gzip/gzip_test.go | 4 ++-- caddyhttp/mime/mime_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/caddyhttp/gzip/gzip_test.go b/caddyhttp/gzip/gzip_test.go index ff94edb8..cc6e571b 100644 --- a/caddyhttp/gzip/gzip_test.go +++ b/caddyhttp/gzip/gzip_test.go @@ -109,10 +109,10 @@ func nextFunc(shouldGzip bool) httpserver.Handler { if shouldGzip { if w.Header().Get("Content-Encoding") != "gzip" { - return 0, fmt.Errorf("Content-Encoding must be gzip, found %v", r.Header.Get("Content-Encoding")) + return 0, fmt.Errorf("Content-Encoding must be gzip, found %v", w.Header().Get("Content-Encoding")) } if w.Header().Get("Vary") != "Accept-Encoding" { - return 0, fmt.Errorf("Vary must be Accept-Encoding, found %v", r.Header.Get("Vary")) + return 0, fmt.Errorf("Vary must be Accept-Encoding, found %v", w.Header().Get("Vary")) } if _, ok := w.(*gzipResponseWriter); !ok { return 0, fmt.Errorf("ResponseWriter should be gzipResponseWriter, found %T", w) diff --git a/caddyhttp/mime/mime_test.go b/caddyhttp/mime/mime_test.go index f97fffad..f3e896dc 100644 --- a/caddyhttp/mime/mime_test.go +++ b/caddyhttp/mime/mime_test.go @@ -57,7 +57,7 @@ func nextFunc(shouldMime bool, contentType string) httpserver.Handler { return httpserver.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) { if shouldMime { if w.Header().Get("Content-Type") != contentType { - return 0, fmt.Errorf("expected Content-Type: %v, found %v", contentType, r.Header.Get("Content-Type")) + return 0, fmt.Errorf("expected Content-Type: %v, found %v", contentType, w.Header().Get("Content-Type")) } return 0, nil }