Skip to content

Commit

Permalink
add implement hijacker in http response wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
agungdwiprasetyo committed Jul 22, 2024
1 parent 4431494 commit fa1ad4e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package candi

const (
// Version of this library
Version = "v1.17.14"
Version = "v1.17.15"
)
12 changes: 12 additions & 0 deletions wrapper/http_response_writer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package wrapper

import (
"bufio"
"bytes"
"errors"
"net"
"net/http"
)

Expand Down Expand Up @@ -66,3 +69,12 @@ func (w *WrapHTTPResponseWriter) WriteHeader(statusCode int) {
// Write the status code onward.
w.ResponseWriter.WriteHeader(statusCode)
}

// Hijack method
func (w *WrapHTTPResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
h, ok := w.ResponseWriter.(http.Hijacker)
if !ok {
return nil, nil, errors.New("hijack not supported")
}
return h.Hijack()
}

0 comments on commit fa1ad4e

Please sign in to comment.