fix SERVER_NAME enforcement in url_for and request.args documentation (#1708)

* 🐛 fix SERVER_NAME enforcement in url_for

fixes #1707

* 💡 add additional documentation for using request.args

fixes #1704

*  add additional test to check url_for without SERVER_NAME

* 📝 add changelog for fixes
This commit is contained in:
Harsha Narayana
2019-11-01 23:02:49 +05:30
committed by 7
parent e506c89304
commit e81a8ce073
5 changed files with 43 additions and 5 deletions

View File

@@ -519,8 +519,11 @@ class Request:
: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 "//" in 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