diff options
author | Kévin Dunglas <kevin@dunglas.fr> | 2023-04-27 01:44:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 19:44:01 -0400 |
commit | 1c9ea0113d007d57bb8f793ebe7a64a3dcad7bc7 (patch) | |
tree | 7f50b0cb2db708f1607436e83dd8b77c3c84046a /modules/caddyhttp/responsewriter_test.go | |
parent | 2b04e09fa7830a2d24d863e448ebbdc51d537fbe (diff) |
caddyhttp: Impl `ResponseWriter.Unwrap()`, prep for Go 1.20's `ResponseController` (#5509)
* feat: add support for ResponseWriter.Unwrap()
* cherry-pick Francis' code
Diffstat (limited to 'modules/caddyhttp/responsewriter_test.go')
-rw-r--r-- | modules/caddyhttp/responsewriter_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/caddyhttp/responsewriter_test.go b/modules/caddyhttp/responsewriter_test.go index 1913932..492fcad 100644 --- a/modules/caddyhttp/responsewriter_test.go +++ b/modules/caddyhttp/responsewriter_test.go @@ -95,6 +95,14 @@ func TestResponseWriterWrapperReadFrom(t *testing.T) { } } +func TestResponseWriterWrapperUnwrap(t *testing.T) { + w := &ResponseWriterWrapper{&baseRespWriter{}} + + if _, ok := w.Unwrap().(*baseRespWriter); !ok { + t.Errorf("Unwrap() doesn't return the underlying ResponseWriter") + } +} + func TestResponseRecorderReadFrom(t *testing.T) { tests := map[string]struct { responseWriter responseWriterSpy |