pupilfirst/pupilfirst

View on GitHub
lib/override_csp.rb

Summary

Maintainability
A
0 mins
Test Coverage
C
75%
class OverrideCsp
  ALLOW_EVERYTHING = "default_src: *"

  def initialize(app, csp = ALLOW_EVERYTHING)
    @app = app
    @csp = csp
  end

  def call(env)
    status, headers, body = @app.call(env)
    [status, headers.merge('Content-Security-Policy' => @csp), body]
  end
end