aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/best_standards_support.rb
blob: d3389962405158b64bcba91093e64833f259dccf (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13

                            
                                    
                








                          



                                            






                                                         



                             
module ActionDispatch
  class BestStandardsSupport
    def initialize(app, type = true)
      @app = app

      @header = case type
      when true
        "IE=Edge,chrome=1"
      when :builtin
        "IE=Edge"
      when false
        nil
      end
    end

    def call(env)
      status, headers, body = @app.call(env)

      if headers["X-UA-Compatible"] && @header
        headers["X-UA-Compatible"] << "," << @header.to_s
      else
        headers["X-UA-Compatible"] = @header
      end

      [status, headers, body]
    end
  end
end