Sha256: d2802cdc4e2e0f039a34b3e14daa4ba6a6e06026a25639747e7c238fccc1b117
Contents?: true
Size: 621 Bytes
Versions: 1
Compression:
Stored size: 621 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.to_s != "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.1 | lib/javascript_eraser.rb |