Skip to content

Commit d970644

Browse files
committed
Allow reason empty string to match None on closing
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.
1 parent ec8596f commit d970644

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wsproto/frame_protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def close(self, code: Optional[int] = None, reason: Optional[str] = None) -> byt
571571
payload = bytearray()
572572
if code is CloseReason.NO_STATUS_RCVD:
573573
code = None
574-
if code is None and reason is not None:
574+
if code is None and reason:
575575
raise TypeError("cannot specify a reason without a code")
576576
if code in LOCAL_ONLY_CLOSE_REASONS:
577577
code = CloseReason.NORMAL_CLOSURE

0 commit comments

Comments
 (0)