Module: HTTPX::Plugins::Expect::InstanceMethods

Defined in:
lib/httpx/plugins/expect.rb

Instance Method Summary collapse

Instance Method Details

#fetch_response(request, selector, options) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/httpx/plugins/expect.rb', line 99

def fetch_response(request, selector, options)
  response = super

  return unless response

  if response.is_a?(Response) && response.status == 417 && request.headers.key?("expect")
    response.close
    request.headers.delete("expect")
    request.transition(:idle)
    send_request(request, selector, options)
    return
  end

  response
end