 
   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,
+        url: url(conn),
         remote: "#{a}.#{b}.#{c}.#{d}",
         method: conn.method,
         headers: conn.req_headers, # Maybe failed to convert

        readbody conn
    end
  end
end

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