lib/wicked_pdf/middleware.rb in wicked_pdf-1.0.1 vs lib/wicked_pdf/middleware.rb in wicked_pdf-1.0.2

- old
+ new

@@ -1,15 +1,15 @@ class WickedPdf class Middleware def initialize(app, options = {}, conditions = {}) - @app = app - @options = (WickedPdf.config || {}).merge(options) + @app = app + @options = (WickedPdf.config || {}).merge(options) @conditions = conditions end def call(env) - @request = Rack::Request.new(env) + @request = Rack::Request.new(env) @render_pdf = false set_request_to_render_as_pdf(env) if render_as_pdf? status, headers, response = @app.call(env) @@ -23,13 +23,13 @@ # Do not cache PDFs headers.delete('ETag') headers.delete('Cache-Control') - headers['Content-Length'] = (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s - headers['Content-Type'] = 'application/pdf' + headers['Content-Length'] = (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s + headers['Content-Type'] = 'application/pdf' if @options.fetch(:disposition, '') == 'attachment' - headers['Content-Disposition'] = 'attachment' + headers['Content-Disposition'] = 'attachment' headers['Content-Transfer-Encoding'] = 'binary' end end [status, headers, response]