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