diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-02-05 20:06:16 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-02-05 20:07:19 +1300 |
commit | bf991d11881df2b3f4bc4f22b576bd456de1f247 (patch) | |
tree | e9c8d5dd34851d34f91cf07ee965dc793f0c46ce /lib | |
parent | f71cff5703173333ec01f0451d488b82be0dd5d7 (diff) | |
download | rack-response-body.tar.gz |
Remove `Rack::Files#response_body` as the implementation was broken.response-body
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rack/files.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/rack/files.rb b/lib/rack/files.rb index d12307fd..7d728a9d 100644 --- a/lib/rack/files.rb +++ b/lib/rack/files.rb @@ -16,6 +16,13 @@ module Rack ALLOW_HEADER = ALLOWED_VERBS.join(', ') MULTIPART_BOUNDARY = 'AaB03x' + # @todo remove in 3.0 + def self.method_added(name) + if name == :response_body + raise "#{self.class}\#response_body is no longer supported." + end + end + attr_reader :root def initialize(root, headers = {}, default_mime = 'text/plain') @@ -201,20 +208,10 @@ EOF end def filesize(path) - # If response_body is present, use its size. - return response_body.bytesize if response_body - # We check via File::size? whether this file provides size info # via stat (e.g. /proc files often don't), otherwise we have to # figure it out by reading the whole file into memory. ::File.size?(path) || ::File.read(path).bytesize end - - # By default, the response body for file requests is nil. - # In this case, the response body will be generated later - # from the file at @path - def response_body - nil - end end end |