lib/grover/middleware.rb in grover-0.12.1 vs lib/grover/middleware.rb in grover-0.12.2
- old
+ new
@@ -95,12 +95,18 @@
end
def create_grover_for_response(response)
body = response.respond_to?(:body) ? response.body : response.join
body = body.join if body.is_a?(Array)
-
body = HTMLPreprocessor.process body, root_url, protocol
- Grover.new(body, display_url: request_url)
+
+ options = { display_url: request_url }
+ cookies = Rack::Utils.parse_cookies(env).map do |name, value|
+ { name: name, value: value, domain: env['HTTP_HOST'] }
+ end
+ options[:cookies] = cookies if cookies.any?
+
+ Grover.new(body, options)
end
def add_cover_content(grover)
pdf = CombinePDF.parse grover.to_pdf
pdf >> fetch_cover_pdf(grover.front_cover_path) if grover.show_front_cover?