Skip to content

Commit

Permalink
Remove pre Go1.20 support
Browse files Browse the repository at this point in the history
  • Loading branch information
aldas committed Aug 16, 2024
1 parent 27c55f2 commit d20a625
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 134 deletions.
4 changes: 2 additions & 2 deletions middleware/body_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ func (w *bodyDumpResponseWriter) Write(b []byte) (int, error) {
}

func (w *bodyDumpResponseWriter) Flush() {
err := responseControllerFlush(w.ResponseWriter)
err := http.NewResponseController(w.ResponseWriter).Flush()
if err != nil && errors.Is(err, http.ErrNotSupported) {
panic(errors.New("response writer flushing is not supported"))
}
}

func (w *bodyDumpResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return responseControllerHijack(w.ResponseWriter)
return http.NewResponseController(w.ResponseWriter).Hijack()
}

func (w *bodyDumpResponseWriter) Unwrap() http.ResponseWriter {
Expand Down
4 changes: 2 additions & 2 deletions middleware/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ func (w *gzipResponseWriter) Flush() {
}

w.Writer.(*gzip.Writer).Flush()
_ = responseControllerFlush(w.ResponseWriter)
_ = http.NewResponseController(w.ResponseWriter).Flush()
}

func (w *gzipResponseWriter) Unwrap() http.ResponseWriter {
return w.ResponseWriter
}

func (w *gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return responseControllerHijack(w.ResponseWriter)
return http.NewResponseController(w.ResponseWriter).Hijack()
}

func (w *gzipResponseWriter) Push(target string, opts *http.PushOptions) error {
Expand Down
44 changes: 0 additions & 44 deletions middleware/responsecontroller_1.19.go

This file was deleted.

20 changes: 0 additions & 20 deletions middleware/responsecontroller_1.20.go

This file was deleted.

4 changes: 2 additions & 2 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (r *Response) Write(b []byte) (n int, err error) {
// buffered data to the client.
// See [http.Flusher](https://golang.org/pkg/net/http/#Flusher)
func (r *Response) Flush() {
err := responseControllerFlush(r.Writer)
err := http.NewResponseController(r.Writer).Flush()
if err != nil && errors.Is(err, http.ErrNotSupported) {
panic(errors.New("response writer flushing is not supported"))
}
Expand All @@ -96,7 +96,7 @@ func (r *Response) Flush() {
// take over the connection.
// See [http.Hijacker](https://golang.org/pkg/net/http/#Hijacker)
func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) {
return responseControllerHijack(r.Writer)
return http.NewResponseController(r.Writer).Hijack()
}

// Unwrap returns the original http.ResponseWriter.
Expand Down
44 changes: 0 additions & 44 deletions responsecontroller_1.19.go

This file was deleted.

20 changes: 0 additions & 20 deletions responsecontroller_1.20.go

This file was deleted.

0 comments on commit d20a625

Please sign in to comment.