Sha256: 543e9b94dee672815f7cded4a7405039d4dd8ff6b1391bcf6e4b0c5cdd760c62
Contents?: true
Size: 616 Bytes
Versions: 1
Compression:
Stored size: 616 Bytes
Contents
class JavascriptEraser def initialize(app) @app = app end def call(env) status, headers, response = @app.call(env) if headers['Content-Type'] and headers['Content-Type'].include?("javascript") response = "" elsif response.respond_to?(:body) and response.body.is_a?(String) response.body = response.body.gsub(/<script(.|\n)*?type(.|\n)*?javascript(.|\n)*?\/script>/,"") elsif response.class != "Rack::File" puts "JavascriptEraser: unknown response type: #{response.class}. check order of appearance in middleware stack." end [status, headers, response] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
javascript_eraser-1.0.0 | lib/javascript_eraser.rb |