summary refs log tree commit
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2022-05-10 10:55:53 -0700
committerJeremy Evans <code@jeremyevans.net>2022-05-25 08:33:11 -0700
commita1b3a53b2986b81c99e3ccde50dca5942c3bee98 (patch)
tree51b48bade7901b63b26b88340d375f16f37148ab
parenta6a66047c9af0ce0a014db7931f8b873cf1b113e (diff)
downloadrack-a1b3a53b2986b81c99e3ccde50dca5942c3bee98.tar.gz
Remove unnecessary conditional in rack/static.rb
Mime.mime_type always returns a value.  The only way it wouldn't
is if MIME_TYPES was modified to have an entry with a nil/false
value, which would seem to violate the expectations of
Mime.mime_type, which is documented to return a string if the
mime type is found.
-rw-r--r--lib/rack/static.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/rack/static.rb b/lib/rack/static.rb
index f981397b..5c9b6760 100644
--- a/lib/rack/static.rb
+++ b/lib/rack/static.rb
@@ -139,9 +139,7 @@ module Rack
           elsif response[0] == 304
             # Do nothing, leave headers as is
           else
-            if mime_type = Mime.mime_type(::File.extname(path), 'text/plain')
-              response[1][CONTENT_TYPE] = mime_type
-            end
+            response[1][CONTENT_TYPE] = Mime.mime_type(::File.extname(path), 'text/plain')
             response[1]['content-encoding'] = 'gzip'
           end
         end