Skip to content

Commit

Permalink
Add Plug.Conn.Utils tests
Browse files Browse the repository at this point in the history
* Add test for when Plug.Conn.Utils.content_type/1 is given a
  binary that is an erroneous content type.

* Add test for when Plug.Conn.Utils.params/1 is given a binary
  containing a parameter key but no value.
  • Loading branch information
thymusvulgaris committed Jun 21, 2024
1 parent 872f079 commit df9e487
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/plug/conn/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ defmodule Plug.Conn.Utils do
iex> content_type "*/*"
:error
iex> content_type "something"
:error
"""
@spec content_type(binary) :: {:ok, type :: binary, subtype :: binary, params} | :error
def content_type(binary) do
Expand Down Expand Up @@ -162,6 +165,9 @@ defmodule Plug.Conn.Utils do
iex> params(";")
%{}
iex> params("foo=")
%{}
"""
@spec params(binary) :: params
def params(t) do
Expand Down

0 comments on commit df9e487

Please sign in to comment.