lib/httpx/plugins/expect.rb in httpx-0.22.1 vs lib/httpx/plugins/expect.rb in httpx-0.22.2
- old
+ new
@@ -48,11 +48,12 @@
@headers["expect"] = "100-continue"
end
def response=(response)
- if response && response.status == 100 &&
+ if response.is_a?(Response) &&
+ response.status == 100 &&
!@headers.key?("expect") &&
(@state == :body || @state == :done)
# if we're past this point, this means that we just received a 100-Continue response,
# but the request doesn't have the expect flag, and is already flushing (or flushed) the body.
@@ -90,10 +91,10 @@
module InstanceMethods
def fetch_response(request, connections, options)
response = @responses.delete(request)
return unless response
- if response.status == 417 && request.headers.key?("expect")
+ if response.is_a?(Response) && response.status == 417 && request.headers.key?("expect")
response.close
request.headers.delete("expect")
request.transition(:idle)
connection = find_connection(request, connections, options)
connection.send(request)