From f22bc41a92e8f51d6f6da5b840f3364474d6aaba Mon Sep 17 00:00:00 2001 From: Kevin Deisz Date: Fri, 6 Apr 2018 15:13:28 -0400 Subject: Include default headers by default in API mode ActionDispatch's default headers are now moved into their own module that are by default included in both Base and API. This allows API-mode applications to take advantage of the default security headers, as well as providing an easy way to add more. --- .../lib/action_controller/metal/default_headers.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 actionpack/lib/action_controller/metal/default_headers.rb (limited to 'actionpack/lib/action_controller/metal/default_headers.rb') diff --git a/actionpack/lib/action_controller/metal/default_headers.rb b/actionpack/lib/action_controller/metal/default_headers.rb new file mode 100644 index 0000000000..eef0602fcd --- /dev/null +++ b/actionpack/lib/action_controller/metal/default_headers.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module ActionController + # Allows configuring default headers that will be automatically merged into + # each response. + module DefaultHeaders + extend ActiveSupport::Concern + + module ClassMethods + def make_response!(request) + ActionDispatch::Response.create.tap do |res| + res.request = request + end + end + end + end +end -- cgit v1.2.3