Sha256: 13a1ba19c78eb2d1b19a99de98b344b768686477f99c3363b4bab245938c3b84

Contents?: true

Size: 459 Bytes

Versions: 4

Compression:

Stored size: 459 Bytes

Contents

# frozen_string_literal: true

module Grape
  module ServeFile
    # Response should respond to to_path method
    # for using Rack::SendFile middleware
    class SendfileResponse < Rack::Response
      def respond_to?(method_name, include_all = false)
        if method_name == :to_path
          @body.respond_to?(:to_path, include_all)
        else
          super
        end
      end

      def to_path
        @body.to_path
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
grape-1.3.3 lib/grape/serve_file/sendfile_response.rb
grape-1.3.2 lib/grape/serve_file/sendfile_response.rb
grape-1.3.1 lib/grape/serve_file/sendfile_response.rb
grape-1.3.0 lib/grape/serve_file/sendfile_response.rb