Skip to content

Commit 0e00760

Browse files
cristalolegnhooyr
authored andcommitted
Invert if to the more consistent style
1 parent 155bca6 commit 0e00760

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

handshake.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ func authenticateOrigin(r *http.Request) error {
221221
if err != nil {
222222
return fmt.Errorf("failed to parse Origin header %q: %w", origin, err)
223223
}
224-
if strings.EqualFold(u.Host, r.Host) {
225-
return nil
224+
if !strings.EqualFold(u.Host, r.Host) {
225+
return fmt.Errorf("request Origin %q is not authorized for Host %q", origin, r.Host)
226226
}
227-
return fmt.Errorf("request Origin %q is not authorized for Host %q", origin, r.Host)
227+
return nil
228228
}
229229

230230
// DialOptions represents the options available to pass to Dial.

0 commit comments

Comments
 (0)