         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

defmodule HttpProxy.Data do
  @derive [JSX.Encoder]
  defstruct [
    # request: [:host, :port, :remote, :method, :scheme, :request_path, :req_headers, :query_string, :query_body, :cookies, :query_params, :req_cookies],
    request: [:host, :port, :remote, :method, :scheme, :request_path, :req_headers, :query_string, :query_body, :query_params],
    # response: [:resp_body, :resp_cookies, :scheme, :status]
    response: [:resp_body, :scheme, :status]
  ]
end

# TODO: update formats

        body: conn.resp_body,
        cookies: conn.resp_cookies,
        status_code: conn.status,
        headers: resp_headers(conn)
      }
    }
    |> JSX.encode!
