Skip to content

Commit

Permalink
Page#text?: Updated to also check content-type for text/html
Browse files Browse the repository at this point in the history
[Issue #50]
  • Loading branch information
Zapotek committed Aug 30, 2013
1 parent 01300b3 commit c0d8345
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/arachni/page.rb
Expand Up @@ -243,7 +243,9 @@ def document
# @return [Boolean]
# `true` if the page contains client-side code, `false` otherwise.
def has_script?
return if !document
return if !document || !text? ||
!response.headers.content_type.to_s.start_with?( 'text/html' )

return @has_javascript if !@has_javascript.nil?

# First check, quick and simple.
Expand Down
2 changes: 1 addition & 1 deletion spec/arachni/page_spec.rb
Expand Up @@ -187,7 +187,7 @@ def create_page( options = {} )
end

describe '#text?' do
context 'when the HTTP response was text based' do
context 'when the HTTP response is text/html' do
it 'returns true' do
res = Arachni::HTTP::Response.new(
url: 'http://test.com',
Expand Down

0 comments on commit c0d8345

Please sign in to comment.