Skip to content

Commit

Permalink
change url_for signature to return URL
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee committed Feb 13, 2023
1 parent 30d4f58 commit 9cc848f
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions starlette/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,10 @@ def state(self) -> State:
self._state = State(self.scope["state"])
return self._state

<<<<<<< HEAD
def url_for(self, name: str, **path_params: typing.Any) -> URL:
=======
def url_for(
self, name: str, query_params: dict = None, **path_params: typing.Any
) -> str:
>>>>>>> dc19461 (Add query parameters)
router: Router = self.scope["router"]
url_path = router.url_path_for(name, **path_params)
absolute_url = URL(url_path.make_absolute_url(base_url=self.base_url))
if query_params:
absolute_url = absolute_url.include_query_params(**query_params)
return absolute_url._url
return URL(url_path.make_absolute_url(base_url=self.base_url))


async def empty_receive() -> typing.NoReturn:
Expand Down

0 comments on commit 9cc848f

Please sign in to comment.