Skip to content

Commit

Permalink
Merge pull request #22 from mantri/master
Browse files Browse the repository at this point in the history
Add HTTP status code to ErrBadStatus
  • Loading branch information
meslubi2021 authored Dec 13, 2024
2 parents aed4e75 + 52df747 commit 8143e08
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions websocket/hybi.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"net/http"
"net/url"
"strings"
"strconv"
)

const (
Expand Down Expand Up @@ -441,6 +442,7 @@ func hybiClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) (er
return err
}
if resp.StatusCode != 101 {
ErrBadStatus.ErrorString = "bad status: " + strconv.Itoa(resp.StatusCode)
return ErrBadStatus
}
if strings.ToLower(resp.Header.Get("Upgrade")) != "websocket" ||
Expand Down

0 comments on commit 8143e08

Please sign in to comment.