Skip to content
Browse files

Merge pull request #70 from aaronjensen/html_attributes

Allow for attributes in the html tag.
  • Loading branch information...
2 parents 3b4f466 + a6e0a59 commit 516f959b2875a0013dac549d912349316af2fc23 @flyerhzm committed Jul 15, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/bullet/rack.rb
  2. +6 −0 spec/bullet/rack_spec.rb
View
2 lib/bullet/rack.rb
@@ -37,7 +37,7 @@ def file?(headers)
end
def html_request?(headers, response)
- headers['Content-Type'] && headers['Content-Type'].include?('text/html') && response.body.include?("<html>")
+ headers['Content-Type'] && headers['Content-Type'].include?('text/html') && response.body.include?("<html")
end
def no_browser_cache(headers)
View
6 spec/bullet/rack_spec.rb
@@ -22,6 +22,12 @@ module Bullet
middleware.should be_html_request(headers, response)
end
+ it "should be true if Content-Type is text/html and http body contains html tag with attributes" do
+ headers = {"Content-Type" => "text/html"}
+ response = stub(:body => "<html attr='hello'><head></head><body></body></html>")
+ middleware.should be_html_request(headers, response)
+ end
+
it "should be false if there is no Content-Type header" do
headers = {}
response = stub(:body => "<html><head></head><body></body></html>")

0 comments on commit 516f959

Please sign in to comment.
Something went wrong with that request. Please try again.