Module: Idempo::RequestFingerprint
- Defined in:
- lib/idempo/request_fingerprint.rb
Class Method Summary collapse
Class Method Details
.call(idempotency_key, rack_request) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/idempo/request_fingerprint.rb', line 2 def self.call(idempotency_key, rack_request) d = Digest::SHA256.new d << idempotency_key << "\n" d << rack_request.url << "\n" d << rack_request.request_method << "\n" d << rack_request.get_header("HTTP_AUTHORIZATION").to_s << "\n" while (chunk = rack_request.env["rack.input"].read(1024 * 65)) d << chunk end Base64.strict_encode64(d.digest) ensure rack_request.env["rack.input"].rewind end |