class BreezyPDFLite::Intercept::HTML

Takes the App's response body, and submits it to the breezypdf lite endpoint resulting in a file. File is then served with Rack::File

Public Instance Methods

call() click to toggle source
# File lib/breezy_pdf_lite/intercept/html.rb, line 10
def call
  request = Rack::Request.new({})
  path = render_request_file.path

  Rack::File.new(path, response_headers).serving(request, path)
end

Private Instance Methods

render_request() click to toggle source
# File lib/breezy_pdf_lite/intercept/html.rb, line 19
def render_request
  @render_request ||= BreezyPDFLite::RenderRequest.new(body)
end
render_request_file() click to toggle source
# File lib/breezy_pdf_lite/intercept/html.rb, line 23
def render_request_file
  @render_request_file ||= render_request.to_file
end
response_headers() click to toggle source
# File lib/breezy_pdf_lite/intercept/html.rb, line 27
def response_headers
  @response_headers ||= {
    "Content-Type" => "application/pdf",
    "Content-Disposition" => render_request.response.header["Content-Disposition"]
  }
end