 
   @doc """
   Deletes all `header` values in `message`.
+
+  ## Examples:
+
+      iex> request =
+      ...>   Sippet.Message.build_request(:invite, "sip:foo@bar.com")
+      ...>   |> Sippet.Message.put_header(:content_language, ["en-US", "de-DE"])
+      ...>   |> Sippet.Message.put_header(:max_forwards, 70)
+      iex> request |> Sippet.Message.delete_header(:content_language)
+      %Sippet.Message{body: nil, headers: %{max_forwards: 70},
+       start_line: %Sippet.Message.RequestLine{method: :invite,
+        request_uri: %Sippet.URI{authority: "foo@bar.com", headers: nil,
+         host: "bar.com", parameters: nil, port: 5060, scheme: "sip",
+         userinfo: "foo"}, version: {2, 0}}, target: nil}
+
   """
   @spec delete_header(t, header) :: t
   def delete_header(message, header) do


  @doc """
  Drops all given `headers` from `message`.
  """
  @spec drop_headers(t, [header]) :: t
  def drop_headers(message, headers) do
    %{message | headers: Map.drop(message.headers, headers)}
  end

  @doc """
  Fetches all values for a specific `header` and returns it in a tuple.

  If the `header` does not exist, returns `:error`.
  """
  @spec fetch_header(t, header) :: {:ok, value} | :error
  def fetch_header(message, header) do
    Map.fetch(message.headers, header)
  end

  @doc """
  Fetches the first value of a specific `header` and returns it in a tuple.

  If the `header` does not exist, returns `:error`. If the `header` exists but
  it is an empty list, returns `{:ok, nil}`.
  """
  @spec fetch_header_front(t, header) :: {:ok, multiple_value} | :error
  def fetch_header_front(message, header) do
    case fetch_header(message, header) do
      {:ok, values} ->
        if Enum.empty?(values) do
          {:ok, nil}
        else
          {:ok, List.first(values)}
        end
      _otherwise ->
        :error
    end


  @doc """
  Shortcut to check if the message is a response.

  ## Examples:

      iex> resp = Sippet.Message.build_response 200
      iex> resp |> Sippet.Message.response?
      true

  """
  @spec response?(t) :: boolean
  def response?(%__MODULE__{start_line: %StatusLine{}} = _), do: true
