       ...> |> Raxx.HTTP1.serialize_response(connection: :close)
       ...> |> elem(0)
       ...> |> :erlang.iolist_to_binary()
-      "HTTP/1.1 204 No Content\\r\\nconnection: close\\r\\nfoo: bar\\r\\n\\r\\n"
+      "HTTP/1.1 204 No Content\r\nconnection: close\r\nfoo: bar\r\n\r\n"
 
       iex> Raxx.response(204)
       ...> |> Raxx.set_header("foo", "bar")
       ...> |> Raxx.HTTP1.serialize_response(connection: :keepalive)
       ...> |> elem(0)
       ...> |> :erlang.iolist_to_binary()
-      "HTTP/1.1 204 No Content\\r\\nconnection: keep-alive\\r\\nfoo: bar\\r\\n\\r\\n"
+      "HTTP/1.1 204 No Content\r\nconnection: keep-alive\r\nfoo: bar\r\n\r\n"
   """
   @spec serialize_response(Raxx.Response.t(), [{:connection, connection_status}]) ::
           {iolist, body_read_state}

        }, :keepalive, {:complete, ""}, ""}}

      # Test line_length is limited
      # "GET /" +  "HTTP/1.1\\r\\n" = 15
      iex> path = "/" <> String.duplicate("a", 985)
      ...> "GET \#{path} HTTP/1.1\\r\\n"
      ...> |> Raxx.HTTP1.parse_request(scheme: :http)
      {:error, {:line_length_limit_exceeded, :request_line}}

      iex> path = "/" <> String.duplicate("a", 984)
      ...> {:more, _} = "GET \#{path} HTTP/1.1\\r\\n"
      ...> |> Raxx.HTTP1.parse_request(scheme: :http)
      ...> :ok
      :ok

      iex> path = "/" <> String.duplicate("a", 1984)
      ...> {:more, _} = "GET \#{path} HTTP/1.1\\r\\n"
      ...> |> Raxx.HTTP1.parse_request(scheme: :http, maximum_line_length: 2000)
      ...> :ok
      :ok

      iex> "GET / HTTP/1.1\\r\\nhost: \#{String.duplicate("a", 993)}\\r\\n"
      ...> |> Raxx.HTTP1.parse_request(scheme: :http)
      {:error, {:line_length_limit_exceeded, :header_line}}

      iex> {:more, _} = "GET / HTTP/1.1\\r\\nhost: \#{String.duplicate("a", 992)}\\r\\n"
      ...> |> Raxx.HTTP1.parse_request(scheme: :http)
      ...> :ok
      :ok

      iex> {:more, _} = "GET / HTTP/1.1\\r\\nhost: \#{String.duplicate("a", 1992)}\\r\\n"
      ...> |> Raxx.HTTP1.parse_request(scheme: :http, maximum_line_length: 2000)
      ...> :ok
      :ok

    end
  end

  @doc ~S"""
  Serialize io_data as a single chunk to be streamed.

  ## Example

      iex> Raxx.HTTP1.serialize_chunk("hello")
      ...> |> to_string()
      "5\r\nhello\r\n"

      iex> Raxx.HTTP1.serialize_chunk("")
      ...> |> to_string()
      "0\r\n\r\n"
  """
  @spec serialize_chunk(iodata) :: iodata
  def serialize_chunk(data) do
