Sha256: ed54470ddbb1872765cec307cf7f4d5d67c5093c05331ecaf16771b9d297dfdf
Contents?: true
Size: 1.25 KB
Versions: 20
Compression:
Stored size: 1.25 KB
Contents
module Skylight module Normalizers # Temporary hacks begin require "action_dispatch/http/mime_type" require "action_dispatch/http/mime_types" require "rack/utils" class SendFile < Normalizer register "send_file.action_controller" def normalize(trace, name, payload) path = payload[:path] annotations = { path: path, filename: payload[:filename], type: normalize_type(payload), disposition: normalize_disposition(payload), status: normalize_status(payload) } # These will eventually be different title = desc = "send file: #{path}" [ "app.controller.send_file", title, desc, annotations ] end private def normalize_type(payload) type = payload[:type] || "application/octet-stream" type = Mime[type].to_s if type.is_a?(Symbol) type end def normalize_status(payload) status = payload[:status] || 200 Rack::Utils.status_code(status) end def normalize_disposition(payload) payload[:disposition] || "attachment" end end rescue LoadError end end end
Version data entries
20 entries across 20 versions & 1 rubygems