Sha256: c59619ec48258a14a5fb0096f275abd36bf6c6080b16071744394ba90d09ddd3
Contents?: true
Size: 646 Bytes
Versions: 29
Compression:
Stored size: 646 Bytes
Contents
require 'rack/request' require 'rack/response' module HtmlMockup module Rack class HtmlValidator def initialize(app) @app = app end def call(env) resp = @app.call(env) if resp[1]["Content-Type"].to_s.include?("html") str = "" resp[2].each{|c| str << c} validator = W3CValidator.new(str) validator.validate! if !validator.valid env["rack.errors"].puts "Validation failed on #{env["PATH_INFO"]}: (errors: #{validator.errors}, warnings: #{validator.warnings})" end end resp end end end end
Version data entries
29 entries across 29 versions & 2 rubygems