From 703fb8d970b3a0fcb632f7228ad6e70c5f308d20 Mon Sep 17 00:00:00 2001 From: yangjinheng <420123641@qq.com> Date: Mon, 27 Feb 2023 14:06:10 +0800 Subject: [PATCH] Update timeouthandler.go --- rest/handler/timeouthandler.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rest/handler/timeouthandler.go b/rest/handler/timeouthandler.go index d234e3cb..fb686285 100644 --- a/rest/handler/timeouthandler.go +++ b/rest/handler/timeouthandler.go @@ -125,6 +125,14 @@ type timeoutWriter struct { var _ http.Pusher = (*timeoutWriter)(nil) +func (tw *timeoutWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { + if hijacked, ok := tw.w.(http.Hijacker); ok { + return hijacked.Hijack() + } + + return nil, nil, errors.New("server doesn't support hijacking") +} + // Header returns the underline temporary http.Header. func (tw *timeoutWriter) Header() http.Header { return tw.h }