Skip to content

Commit 1ae8d7a

Browse files
committed
Fix for gin
Closes #166
1 parent 8bf8877 commit 1ae8d7a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: handshake.go

+7
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ func accept(w http.ResponseWriter, r *http.Request, opts *AcceptOptions) (*Conn,
141141

142142
w.WriteHeader(http.StatusSwitchingProtocols)
143143

144+
// Fix for gin, see #166
145+
if w, ok := w.(interface {
146+
WriteHeaderNow()
147+
}); ok {
148+
w.WriteHeaderNow()
149+
}
150+
144151
netConn, brw, err := hj.Hijack()
145152
if err != nil {
146153
err = fmt.Errorf("failed to hijack connection: %w", err)

0 commit comments

Comments
 (0)