I wish to print the response time that is set by Rack::Runtime on my view. I know we can get all of the HTTP headers by " curl -I address ".
However, the response object in Rails controller only contains several headers by default:
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'SAMEORIGIN',
'X-XSS-Protection' => '1; mode=block',
'X-Content-Type-Options' => 'nosniff'
}
I'm afraid there's no such way. The reason is
X-Runtime
header to the response, the view has already been rendered. This is obvious because if not, how could Rack tell how long the view rendering takes? So you can't insert the value into your view at server side.