Skip to content

Commit

Permalink
Add guards to media_type
Browse files Browse the repository at this point in the history
Closes #1180.
  • Loading branch information
josevalim committed Oct 24, 2023
1 parent 4088bc4 commit bbbb064
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/plug/conn/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ defmodule Plug.Conn.Utils do
"""
@spec media_type(binary) :: {:ok, type :: binary, subtype :: binary, params} | :error
def media_type(binary) do
def media_type(binary) when is_binary(binary) do
case strip_spaces(binary) do
"*/*" <> t -> mt_params(t, "*", "*")
t -> mt_first(t, "")
Expand Down

0 comments on commit bbbb064

Please sign in to comment.