Just scratching a personal itch. I had a couple of headers to set on my response i.e. real world example …
module API
class BaseController < ApplicationController
after_action :set_rate_limit_headers!
def set_rate_limit_headers!
rate_limit_headers = {
"X-RateLimit-Limit"=>"7200",
"X-RateLimit-Remaining"=>"7197",
"X-RateLimit-Reset"=>"2021-03-13T18:00:00Z"
}
rate_limit_headers.each { |name, value| response.set_header(name, value) }
end
end
end
It would be great if I was able to do something like this …
module API
class BaseController < ApplicationController
after_action :set_rate_limit_headers!
def set_rate_limit_headers!
rate_limit_headers = {
"X-RateLimit-Limit"=>"7200",
"X-RateLimit-Remaining"=>"7197",
"X-RateLimit-Reset"=>"2021-03-13T18:00:00Z"
}
response.set_headers(rate_limit_headers)
end
end
end