Module: HTTPX::Plugins::Expect::OptionsMethods

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

Overview

adds support for the following options:

:expect_timeout

time (in seconds) to wait for a 100-expect response, before retrying without the Expect header (defaults to 2).

:expect_threshold_size

min threshold (in bytes) of the request payload to enable the 100-continue negotiation on.

Instance Method Summary collapse

Instance Method Details

#option_expect_threshold_size(value) ⇒ Object

Raises:

  • (TypeError)


36
37
38
39
40
41
# File 'lib/httpx/plugins/expect.rb', line 36

def option_expect_threshold_size(value)
  bytes = Integer(value)
  raise TypeError, ":expect_threshold_size must be positive" unless bytes.positive?

  bytes
end

#option_expect_timeout(value) ⇒ Object

Raises:

  • (TypeError)


29
30
31
32
33
34
# File 'lib/httpx/plugins/expect.rb', line 29

def option_expect_timeout(value)
  seconds = Float(value)
  raise TypeError, ":expect_timeout must be positive" unless seconds.positive?

  seconds
end