Public Class methods
new(*)
[show source]
# File lib/httpx/plugins/expect.rb 47 def initialize(*) 48 super 49 return if @body.empty? 50 51 threshold = @options.expect_threshold_size 52 return if threshold && !@body.unbounded_body? && @body.bytesize < threshold 53 54 return if Expect.no_expect_store.include?(origin) 55 56 @headers["expect"] = "100-continue" 57 end
Public Instance methods
response=(response)
[show source]
# File lib/httpx/plugins/expect.rb 59 def response=(response) 60 if response.is_a?(Response) && 61 response.status == 100 && 62 !@headers.key?("expect") && 63 (@state == :body || @state == :done) 64 65 # if we're past this point, this means that we just received a 100-Continue response, 66 # but the request doesn't have the expect flag, and is already flushing (or flushed) the body. 67 # 68 # this means that expect was deactivated for this request too soon, i.e. response took longer. 69 # 70 # so we have to reactivate it again. 71 @headers["expect"] = "100-continue" 72 @informational_status = 100 73 Expect.no_expect_store.delete(origin) 74 end 75 super 76 end