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