@@ -274,7 +274,9 @@ def write_request(authority, method, target, version, headers)
274274 # @parameter status [Integer] the HTTP status code.
275275 # @parameter headers [Hash] the HTTP headers.
276276 # @parameter reason [String] the reason phrase, defaults to the standard reason phrase for the status code.
277- def write_response ( version , status , headers , reason = Reason ::DESCRIPTIONS [ status ] )
277+ def write_response ( version , status , headers , reason = nil )
278+ reason ||= Reason ::DESCRIPTIONS [ status ]
279+
278280 unless @state == :open or @state == :half_closed_remote
279281 raise ProtocolError , "Cannot write response in state: #{ @state } !"
280282 end
@@ -292,7 +294,9 @@ def write_response(version, status, headers, reason = Reason::DESCRIPTIONS[statu
292294 # @parameter headers [Hash] the HTTP headers.
293295 # @parameter reason [String] the reason phrase, defaults to the standard reason phrase for the status code.
294296 # @raises [ProtocolError] if the connection is not in the open or half-closed remote state.
295- def write_interim_response ( version , status , headers , reason = Reason ::DESCRIPTIONS [ status ] )
297+ def write_interim_response ( version , status , headers , reason = nil )
298+ reason ||= Reason ::DESCRIPTIONS [ status ]
299+
296300 unless @state == :open or @state == :half_closed_remote
297301 raise ProtocolError , "Cannot write interim response in state: #{ @state } !"
298302 end
0 commit comments