diff --git a/rest/handler/timeouthandler.go b/rest/handler/timeouthandler.go index 41fe38f2..b31043a9 100644 --- a/rest/handler/timeouthandler.go +++ b/rest/handler/timeouthandler.go @@ -183,7 +183,9 @@ func (tw *timeoutWriter) writeHeaderLocked(code int) { func (tw *timeoutWriter) WriteHeader(code int) { tw.mu.Lock() defer tw.mu.Unlock() - tw.writeHeaderLocked(code) + if !tw.wroteHeader { + tw.writeHeaderLocked(code) + } } func checkWriteHeaderCode(code int) {