We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e83a3a4 commit c605c8dCopy full SHA for c605c8d
coderd/tracing/status_writer.go
@@ -27,6 +27,7 @@ type StatusWriter struct {
27
http.ResponseWriter
28
Status int
29
Hijacked bool
30
+ Done []func() // If non-nil, this function will be called when the handler is done.
31
responseBody []byte
32
33
wroteHeader bool
@@ -37,6 +38,9 @@ func StatusWriterMiddleware(next http.Handler) http.Handler {
37
38
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
39
sw := &StatusWriter{ResponseWriter: rw}
40
next.ServeHTTP(sw, r)
41
+ for _, done := range sw.Done {
42
+ done()
43
+ }
44
})
45
}
46
0 commit comments