fix bug: netloc always in url if SERVER_NAME defined in config even _external not true

This commit is contained in:
lixxu 2017-02-09 18:26:17 +08:00
parent cf2a363e5e
commit fb419eaa36

View File

@ -239,7 +239,10 @@ class Sanic:
if scheme and not external:
raise ValueError('When specifying _scheme, _external must be True')
netloc = kwargs.pop('_server', self.config.get('SERVER_NAME', ''))
netloc = kwargs.pop('_server', None)
if netloc is None and external:
netloc = self.config.get('SERVER_NAME', '')
for match in matched_params:
name, _type, pattern = self.router.parse_parameter_string(
match)