48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/paltrow/rendering/rails/stream.rb', line 48
def call handler:, page:
handler.response.["Content-Disposition"] = ContentDisposition.format(
disposition: "attachment",
filename: page.locals.fetch(:filename)
)
handler.response. "Content-Length"
handler.response.["Cache-Control"] = "no-cache"
handler.response.["Last-Modified"] = Time.now.httpdate.to_s
handler.response.["X-Accel-Buffering"] = "no"
begin
page
.locals
.fetch(:content_stream)
.each_chunk { |chunk| handler.response.stream.write(chunk) }
ensure
handler.response.stream.close
end
end
|