Sha256: 418216fb1bd00ac4138ade6282bbad3a2aeed4bbf6fb9992a784c0cb8a8cb508
Contents?: true
Size: 850 Bytes
Versions: 2
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true require "rack/request" require "rack/file" module BreezyPDFLite::Intercept # 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 class HTML < Base def call request = Rack::Request.new({}) path = render_request_file.path Rack::File.new(path, response_headers).serving(request, path) end private def render_request @render_request ||= BreezyPDFLite::RenderRequest.new(body) end def render_request_file @render_request_file ||= render_request.to_file end def response_headers @response_headers ||= { "Content-Type" => "application/pdf", "Content-Disposition" => render_request.response.header["Content-Disposition"] } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
breezy_pdf_lite-0.1.1 | lib/breezy_pdf_lite/intercept/html.rb |
breezy_pdf_lite-0.1.0 | lib/breezy_pdf_lite/intercept/html.rb |