module HTTPX::Plugins::ContentDigest::ResponseBodyMethods

  1. lib/httpx/plugins/content_digest.rb

Methods

Public Class

  1. new

Public Instance

  1. close
  2. content_digest_buffer
  3. write

Attributes

Public Class methods

new(response, options)
[show source]
   # File lib/httpx/plugins/content_digest.rb
64 def initialize(response, options)
65   super
66 
67   return unless response.headers.key?("content-digest")
68 
69   should_validate = options.validate_content_digest
70   should_validate = should_validate.call(response) if should_validate.respond_to?(:call)
71 
72   return unless should_validate
73 
74   @content_digest_buffer = Response::Buffer.new(
75     threshold_size: @options.body_threshold_size,
76     bytesize: @length,
77     encoding: @encoding
78   )
79 end

Public Instance methods

close()
[show source]
   # File lib/httpx/plugins/content_digest.rb
86 def close
87   if @content_digest_buffer
88     @content_digest_buffer.close
89     @content_digest_buffer = nil
90   end
91   super
92 end
write(chunk)
[show source]
   # File lib/httpx/plugins/content_digest.rb
81 def write(chunk)
82   @content_digest_buffer.write(chunk) if @content_digest_buffer
83   super
84 end