diff options
author | Kévin Dunglas <[email protected]> | 2023-04-27 01:44:01 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-04-26 19:44:01 -0400 |
commit | 1c9ea0113d007d57bb8f793ebe7a64a3dcad7bc7 (patch) | |
tree | 7f50b0cb2db708f1607436e83dd8b77c3c84046a /metrics.go | |
parent | 2b04e09fa7830a2d24d863e448ebbdc51d537fbe (diff) | |
download | caddy-1c9ea0113d007d57bb8f793ebe7a64a3dcad7bc7.tar.gz caddy-1c9ea0113d007d57bb8f793ebe7a64a3dcad7bc7.zip |
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 'metrics.go')
-rw-r--r-- | metrics.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/metrics.go b/metrics.go index 325006fbf..eb6c74ff0 100644 --- a/metrics.go +++ b/metrics.go @@ -66,3 +66,9 @@ func (d *delegator) WriteHeader(code int) { d.status = code d.ResponseWriter.WriteHeader(code) } + +// Unwrap returns the underlying ResponseWriter, necessary for +// http.ResponseController to work correctly. +func (d *delegator) Unwrap() http.ResponseWriter { + return d.ResponseWriter +} |