         body: conn.resp_body,
         cookies: conn.resp_cookies,
         status_code: conn.status,
-        headers: %{
-          "Cache-Control": headers["Cache-Control"] || "",
-          "Content-Type": headers["Content-Type"] || "",
-          "Date": headers["Date"] || "",
-          "Expires": headers["Expires"] || "",
-          "Location": headers["Location"] || "",
-          "Server": headers["Server"] || "",
-          "X-Content-Type-Options": headers["X-Content-Type-Options"] || "",
-          "X-XSS-Protection": headers["X-XSS-Protection"] || ""
-        }
+        headers: resp_headers(conn)
       }
     }
     |> JSX.encode!


  def pretty_json(conn, pretty) when pretty == true do
    {a, b, c, d} = conn.remote_ip
    headers =  conn.resp_headers
               |> Enum.reduce(Map.new, fn {key, value}, acc ->
                 Map.put acc, key, value
               end)

    request_url = "#{conn.scheme}://#{conn.host}:#{Integer.to_string(conn.port)}#{conn.request_path}?#{conn.query_string}"

    %HttpProxy.Data{
      request: %{
        url: request_url,
        remote: "#{a}.#{b}.#{c}.#{d}",
        method: conn.method,
        headers: conn.req_headers, # Maybe failed to convert

        readbody conn
    end
  end
  
  defp url(conn) do
    "#{conn.scheme}://#{conn.host}:#{Integer.to_string(conn.port)}#{conn.request_path}?#{conn.query_string}"
  end
  
  defp resp_headers(conn) do
    conn.resp_headers
    |> Enum.reduce(Map.new, fn {key, value}, acc ->
      Map.put acc, key, value
    end)
  end
end
