Skip to content

Commit 24c3071

Browse files
committed
do not create extenstion symbol if extension does not exist
1 parent d361ef4 commit 24c3071

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/grape/middleware/formatter.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ def before
4242

4343
def format_from_extension
4444
parts = request.path.split('.')
45-
extension = parts.last.to_sym
4645

47-
if parts.size > 1 && content_types.key?(extension)
48-
return extension
46+
if parts.size > 1
47+
extension = parts.last.to_sym
48+
return extension if content_types.key?(extension)
4949
end
5050
nil
5151
end

0 commit comments

Comments
 (0)