module HTTPX::Plugins::ContentDigest::InstanceMethods

  1. lib/httpx/plugins/content_digest.rb

Methods

Public Instance

  1. build_request

Public Instance methods

build_request(*)
[show source]
    # File lib/httpx/plugins/content_digest.rb
 96 def build_request(*)
 97   request = super
 98 
 99   return request if request.empty?
100 
101   return request if request.headers.key?("content-digest")
102 
103   perform_encoding = @options.encode_content_digest
104   perform_encoding = perform_encoding.call(request) if perform_encoding.respond_to?(:call)
105 
106   return request unless perform_encoding
107 
108   digest = base64digest(request.body)
109   request.headers.add("content-digest", "#{@options.content_digest_algorithm}=:#{digest}:")
110 
111   request
112 end