hijacker returns the Hijacker interface of the http.ResponseWriter. It follows the Unwrap method of the http.ResponseWriter if available, matching the behavior of http.ResponseController. If the Hijacker interface is not found, it returns false. Since the http.ResponseController is not available in
(rw http.ResponseWriter)
| 20 | // this function is used to provide a consistent way to check for the |
| 21 | // Hijacker interface across Go versions. |
| 22 | func hijacker(rw http.ResponseWriter) (http.Hijacker, bool) { |
| 23 | for { |
| 24 | switch t := rw.(type) { |
| 25 | case http.Hijacker: |
| 26 | return t, true |
| 27 | case rwUnwrapper: |
| 28 | rw = t.Unwrap() |
| 29 | default: |
| 30 | return nil, false |
| 31 | } |
| 32 | } |
| 33 | } |
searching dependent graphs…