Module: HTTPX::Plugins::ContentDigest::ResponseBodyMethods
- Defined in:
- lib/httpx/plugins/content_digest.rb
Instance Attribute Summary collapse
-
#content_digest_buffer ⇒ Object
readonly
Returns the value of attribute content_digest_buffer.
Instance Method Summary collapse
Instance Attribute Details
#content_digest_buffer ⇒ Object (readonly)
Returns the value of attribute content_digest_buffer.
64 65 66 |
# File 'lib/httpx/plugins/content_digest.rb', line 64 def content_digest_buffer @content_digest_buffer end |
Instance Method Details
#close ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/httpx/plugins/content_digest.rb', line 88 def close if @content_digest_buffer @content_digest_buffer.close @content_digest_buffer = nil end super end |
#initialize(response, options) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/httpx/plugins/content_digest.rb', line 66 def initialize(response, ) super return unless response.headers.key?("content-digest") should_validate = .validate_content_digest should_validate = should_validate.call(response) if should_validate.respond_to?(:call) return unless should_validate @content_digest_buffer = Response::Buffer.new( threshold_size: @options.body_threshold_size, bytesize: @length, encoding: @encoding ) end |
#write(chunk) ⇒ Object
83 84 85 86 |
# File 'lib/httpx/plugins/content_digest.rb', line 83 def write(chunk) @content_digest_buffer.write(chunk) if @content_digest_buffer super end |