File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 22
33## Edge
44
5+ - include invalid status code when raising handshake error
6+
57## 1.2.11
68
79- remove unused base64 require that would cause issues in Ruby 3.4
Original file line number Diff line number Diff line change @@ -108,6 +108,12 @@ def message
108108 end
109109
110110 class InvalidStatusCode < ::WebSocket ::Error ::Handshake
111+ attr_reader :invalid_status_code
112+
113+ def initialize ( invalid_status_code )
114+ @invalid_status_code = invalid_status_code
115+ end
116+
111117 def message
112118 :invalid_status_code
113119 end
Original file line number Diff line number Diff line change @@ -123,7 +123,14 @@ def parse_first_line(line)
123123 line_parts = line . match ( FIRST_LINE )
124124 raise WebSocket ::Error ::Handshake ::InvalidHeader unless line_parts
125125 status = line_parts [ 1 ]
126- raise WebSocket ::Error ::Handshake ::InvalidStatusCode unless status == '101'
126+
127+ # The signature for the error doesn't take the message as the first
128+ # argument, but rather the status code. So this should use the
129+ # initializer to create the error.
130+ #
131+ # rubocop:disable Style/RaiseArgs
132+ raise WebSocket ::Error ::Handshake ::InvalidStatusCode . new ( status ) unless status == '101'
133+ # rubocop:enable Style/RaiseArgs
127134 end
128135 end
129136 end
You can’t perform that action at this time.
0 commit comments