lib/pdfkit/middleware.rb in pdfkit-0.4.0 vs lib/pdfkit/middleware.rb in pdfkit-0.4.1
- old
+ new
@@ -21,14 +21,13 @@
pdf = PDFKit.new(body, @options)
body = pdf.to_pdf
# Do not cache PDFs
- puts "DELETING CACHING"
headers.delete('ETag')
headers.delete('Cache-Control')
- headers["Content-Length"] = body.bytes.to_a.size.to_s
+ headers["Content-Length"] = (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s
headers["Content-Type"] = "application/pdf"
response = [body]
end