Skip to content

Commit

Permalink
Add underscore support for MIME types
Browse files Browse the repository at this point in the history
  • Loading branch information
luisgabrielroldan committed Mar 1, 2024
1 parent 85f0349 commit 2c7e0b7
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 2c7e0b7

Please sign in to comment.