From df9e487ac6464d38374278786aa09ffdcabab646 Mon Sep 17 00:00:00 2001 From: thymusvulgaris <87661013+thymusvulgaris@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:37:53 +0100 Subject: [PATCH] Add Plug.Conn.Utils tests * 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. --- lib/plug/conn/utils.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/plug/conn/utils.ex b/lib/plug/conn/utils.ex index e2652477..a98d09d2 100644 --- a/lib/plug/conn/utils.ex +++ b/lib/plug/conn/utils.ex @@ -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 @@ -162,6 +165,9 @@ defmodule Plug.Conn.Utils do iex> params(";") %{} + iex> params("foo=") + %{} + """ @spec params(binary) :: params def params(t) do