lib/httpx/plugins/upgrade.rb in httpx-0.22.1 vs lib/httpx/plugins/upgrade.rb in httpx-0.22.2
- old
+ new
@@ -33,10 +33,12 @@
module InstanceMethods
def fetch_response(request, connections, options)
response = super
if response
- return response unless response.respond_to?(:headers) && response.headers.key?("upgrade")
+ return response unless response.is_a?(Response)
+
+ return response unless response.headers.key?("upgrade")
upgrade_protocol = response.headers["upgrade"].split(/ *, */).first
return response unless upgrade_protocol && options.upgrade_handlers.registry.key?(upgrade_protocol)