Skip to content

Commit 5c338e3

Browse files
committed
Copy protocol if successful.
1 parent 9dffa99 commit 5c338e3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/async/http/protocol/http2/response.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ def receive_initial_headers(headers, end_stream)
5454
@response.status = status
5555
@headers = ::Protocol::HTTP::Headers.new
5656

57+
# If the protocol request was successful, ensure the response protocol matches:
58+
if status == 200 and protocol = @response.request.protocol
59+
@response.protocol = Array(protocol).first
60+
end
61+
5762
headers.each do |key, value|
5863
# It's guaranteed that this should be the first header:
5964
if key == CONTENT_LENGTH

0 commit comments

Comments
 (0)