Public Class methods
new(*)
[show source]
# File lib/httpx/plugins/expect.rb 71 def initialize(*) 72 super 73 74 @informational_status = nil 75 76 return if @body.empty? 77 78 threshold = @options.expect_threshold_size 79 return if threshold && !@body.unbounded_body? && @body.bytesize < threshold 80 81 return if Expect.no_expect_store.include?(origin) 82 83 @headers["expect"] = "100-continue" 84 end
Public Instance methods
response=(response)
[show source]
# File lib/httpx/plugins/expect.rb 86 def response=(response) 87 if response.is_a?(Response) && 88 response.status == 100 && 89 !@headers.key?("expect") && 90 (@state == :body || @state == :done) 91 92 # if we're past this point, this means that we just received a 100-Continue response, 93 # but the request doesn't have the expect flag, and is already flushing (or flushed) the body. 94 # 95 # this means that expect was deactivated for this request too soon, i.e. response took longer. 96 # 97 # so we have to reactivate it again. 98 @headers["expect"] = "100-continue" 99 @informational_status = 100 100 Expect.no_expect_store.delete(origin) 101 end 102 super 103 end