Class: Apipie::Middleware::ChecksumInHeaders
- Inherits:
-
Object
- Object
- Apipie::Middleware::ChecksumInHeaders
- Defined in:
- lib/apipie/middleware/checksum_in_headers.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ChecksumInHeaders
constructor
A new instance of ChecksumInHeaders.
Constructor Details
#initialize(app) ⇒ ChecksumInHeaders
Returns a new instance of ChecksumInHeaders.
22 23 24 |
# File 'lib/apipie/middleware/checksum_in_headers.rb', line 22 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/apipie/middleware/checksum_in_headers.rb', line 26 def call(env) status, headers, body = @app.call(env) if !Apipie.configuration.checksum_path || env['PATH_INFO'].start_with?(*Apipie.configuration.checksum_path) headers.merge!( 'Apipie-Checksum' => Apipie.checksum ) end return [status, headers, body] end |