Skip to content

Commit

Permalink
add supprt for go1.20 http.rwUnwrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
imxyb committed Mar 28, 2023
1 parent f22ba67 commit c2da744
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return r.Writer.(http.Hijacker).Hijack()
}

// Unwrap returns the original http.ResponseWriter.
// ResponseController can be used to access the original http.ResponseWriter.
// See [https://go.dev/blog/go1.20]
func (r *Response) Unwrap() http.ResponseWriter {
return r.Writer
}

func (r *Response) reset(w http.ResponseWriter) {
r.beforeFuncs = nil
r.afterFuncs = nil
Expand Down

0 comments on commit c2da744

Please sign in to comment.