Module: HTTPX::Plugins::Expect

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

Overview

This plugin makes all HTTP/1.1 requests with a body send the “Expect: 100-continue”.

gitlab.com/honeyryderchuck/httpx/wikis/Expect#expect

Defined Under Namespace

Modules: ConnectionMethods, InstanceMethods, RequestBodyMethods

Constant Summary collapse

EXPECT_TIMEOUT =
2

Class Method Summary collapse

Class Method Details

.extra_options(options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/httpx/plugins/expect.rb', line 13

def self.extra_options(options)
  Class.new(options.class) do
    def_option(:expect_timeout) do |seconds|
      seconds = Integer(seconds)
      raise Error, ":expect_timeout must be positive" unless seconds.positive?

      seconds
    end
  end.new(options).merge(expect_timeout: EXPECT_TIMEOUT)
end