Skip to content

Commit

Permalink
Add underscore support for MIME types (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisgabrielroldan authored Mar 1, 2024
1 parent 85f0349 commit b7e6753
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/plug/conn/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Plug.Conn.Utils do
@upper ?A..?Z
@lower ?a..?z
@alpha ?0..?9
@other [?., ?-, ?+]
@other [?., ?-, ?+, ?_]
@space [?\s, ?\t]
@specials ~c|()<>@,;:\\"/[]?={}|

Expand All @@ -32,6 +32,9 @@ defmodule Plug.Conn.Utils do
iex> media_type "APPLICATION/vnd.ms-data+XML"
{:ok, "application", "vnd.ms-data+xml", %{}}
iex> media_type "application/media_control+xml"
{:ok, "application", "media_control+xml", %{}}
iex> media_type "text/*; q=1.0"
{:ok, "text", "*", %{"q" => "1.0"}}
Expand Down

0 comments on commit b7e6753

Please sign in to comment.