module HTTPX::Plugins::Expect::InstanceMethods

  1. lib/httpx/plugins/expect.rb

Methods

Public Instance

  1. fetch_response

Public Instance methods

fetch_response(request, selector, options)
[show source]
    # File lib/httpx/plugins/expect.rb
128 def fetch_response(request, selector, options)
129   response = super
130 
131   return unless response
132 
133   if response.is_a?(Response) && response.status == 417 && request.headers.key?("expect")
134     response.close
135     request.headers.delete("expect")
136     request.transition(:idle)
137     send_request(request, selector, options)
138 
139     # recalling itself, in case an error was triggered by the above, and we can
140     # verify retriability again.
141     return fetch_response(request, selector, options)
142   end
143 
144   response
145 end