lib/onebox/engine/html.rb in onebox-1.1.0 vs lib/onebox/engine/html.rb in onebox-1.2.0
- old
+ new
@@ -1,11 +1,20 @@
module Onebox
module Engine
module HTML
private
+ # Overwrite for any custom headers
+ def http_params
+ {}
+ end
+
def raw
- @raw ||= Nokogiri::HTML(open(url, read_timeout: timeout))
+ @raw ||= Nokogiri::HTML(open(url, {read_timeout: timeout}.merge(http_params)).read)
+ end
+
+ def html?
+ raw.respond_to(:css)
end
end
end
end