Skip to content

Commit

Permalink
Allow reason empty string to match None on closing
Browse files Browse the repository at this point in the history
This was originally per #153 but I felt it didn't make sense to
change. However, it does and without this change the autobahn tests
fail.
  • Loading branch information
pgjones committed Aug 23, 2022
1 parent ec8596f commit d970644
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wsproto/frame_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def close(self, code: Optional[int] = None, reason: Optional[str] = None) -> byt
payload = bytearray()
if code is CloseReason.NO_STATUS_RCVD:
code = None
if code is None and reason is not None:
if code is None and reason:
raise TypeError("cannot specify a reason without a code")
if code in LOCAL_ONLY_CLOSE_REASONS:
code = CloseReason.NORMAL_CLOSURE
Expand Down

0 comments on commit d970644

Please sign in to comment.