method

serve_file

Importance_0
v7.1.3.2 - Show latest stable - 0 notes - Class: FileServer
serve_file(path, content_type:, disposition:) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activestorage/app/controllers/concerns/active_storage/file_server.rb, line 7
    def serve_file(path, content_type,, disposition))
      ::Rack::Files.new(nil).serving(request, path).tap do |(status, headers, body)|
        self.status = status
        self.response_body = body

        headers.each do |name, value|
          response.headers[name] = value
        end

        response.headers.except!("X-Cascade", "x-cascade") if status == 416
        response.headers["Content-Type"] = content_type || DEFAULT_SEND_FILE_TYPE
        response.headers["Content-Disposition"] = disposition || DEFAULT_SEND_FILE_DISPOSITION
      end
    end
Register or log in to add new notes.