Skip to content

Commit 8b617e2

Browse files
committed
Reduce Array allocations in MimeNegotiation
1 parent a3e392f commit 8b617e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

actionpack/lib/action_dispatch/http/mime_negotiation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def formats
8181
v = if params_readable?
8282
Array(Mime[parameters[:format]])
8383
elsif use_accept_header && valid_accept_header
84-
accepts
84+
accepts.dup
8585
elsif extension_format = format_from_path_extension
8686
[extension_format]
8787
elsif xhr?
@@ -90,7 +90,7 @@ def formats
9090
[Mime[:html]]
9191
end
9292

93-
v = v.select do |format|
93+
v.select! do |format|
9494
format.symbol || format.ref == "*/*"
9595
end
9696

0 commit comments

Comments
 (0)