Module: HTTPX::Plugins::ContentDigest::OptionsMethods

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

Overview

add support for the following options:

:content_digest_algorithm

the digest algorithm to use. Currently supports ‘sha-256` and `sha-512`. (defaults to `sha-256`)

:encode_content_digest

whether a Content-Digest header should be computed for the request; can also be a callable object (i.e. ->(req) { ... }, defaults to true)

:validate_content_digest

whether a Content-Digest header in the response should be validated; can also be a callable object (i.e. ->(res) { ... }, defaults to false)

Instance Method Summary collapse

Instance Method Details

#option_content_digest_algorithm(value) ⇒ Object

Raises:

  • (TypeError)


46
47
48
49
50
# File 'lib/httpx/plugins/content_digest.rb', line 46

def option_content_digest_algorithm(value)
  raise TypeError, ":content_digest_algorithm must be one of 'sha-256', 'sha-512'" unless SUPPORTED_ALGORITHMS.key?(value)

  value
end

#option_encode_content_digest(value) ⇒ Object



52
53
54
# File 'lib/httpx/plugins/content_digest.rb', line 52

def option_encode_content_digest(value)
  value
end

#option_validate_content_digest(value) ⇒ Object



56
57
58
# File 'lib/httpx/plugins/content_digest.rb', line 56

def option_validate_content_digest(value)
  value
end