| Path: | lib/apipie/middleware/checksum_in_headers.rb |
| Last Update: | Wed Mar 15 13:58:42 +0000 2017 |
Middleware for rails app that adds checksum of JSON in the response headers which can help client to realize when JSON has changed
Add the following to your application.rb
require 'apipie/middleware/checksum_in_headers' # Add JSON checksum in headers for smarter caching config.middleware.use "Apipie::Middleware::ChecksumInHeaders"
And in your apipie initializer allow checksum calculation
Apipie.configuration.update_checksum = true
and reload documentation
Apipie.reload_documentation
By default the header is added to requests on /api and /apipie only It can be changed with
Apipie.configuration.checksum_path = ['/prefix/api']
If set to nil the header is added always