Skip to content

Commit

Permalink
🐛 fix SERVER_NAME enforcement in url_for
Browse files Browse the repository at this point in the history
  • Loading branch information
harshanarayana committed Oct 26, 2019
1 parent e506c89 commit 5004a18
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sanic/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,11 @@ def url_for(self, view_name, **kwargs):
:rtype: str
"""
# Full URL SERVER_NAME can only be handled in app.url_for
if "//" in self.app.config.SERVER_NAME:
return self.app.url_for(view_name, _external=True, **kwargs)
try:
if self.app.config.SERVER_NAME:
return self.app.url_for(view_name, _external=True, **kwargs)
except AttributeError:
pass

scheme = self.scheme
host = self.server_name
Expand Down

0 comments on commit 5004a18

Please sign in to comment.