   end
 
   @doc """
-  Returns the current request path, with and without query params.
-
-  By default, the connection's query params are included in
-  the generated path. Custom query params may be used instead
-  by providing a map of your own params. You may also retrieve
-  only the request path by passing an empty map of params.
-
-  ## Examples
+  Returns the current request path with its default query parameters:
 
       iex> current_path(conn)
       "/users/123?existing=param"
 
+  See `current_path/2` to override the default parameters.
+  """
+  def current_path(%Plug.Conn{query_string: ""} = conn) do
+    conn.request_path
+  end
+
+  def current_path(%Plug.Conn{query_string: query_string} = conn) do
+    conn.request_path <> "?" <> query_string
+  end
+
+  @doc """
+  Returns the current path with the given query parameters.
+
+  You may also retrieve only the request path by passing an
+  empty map of params.
+
+  ## Examples
+
+      iex> current_path(conn)
+      "/users/123?existing=param"
+
       iex> current_path(conn, %{new: "param"})
       "/users/123?new=param"
 


  Now when you call `Routes.some_route_url(conn, ...)`, it will use
  the router url set above. Keep in mind that, if you want to generate
  routes to the current domain, it is preferred to use `Routes.some_route_path`
  helpers, as those are always relative.
  """
  def put_router_url(conn, %URI{} = uri) do
    put_private(conn, :phoenix_router_url, uri)

      end

  However, if you want all generated URLs to always have a certain schema,
  host, etc, you may use `put_router_url/2`.
  """
  def current_url(%Plug.Conn{} = conn, %{} = params) do
    Phoenix.Router.Helpers.url(router_module(conn), conn) <> current_path(conn, params)
  end
