From fb419eaa3649e1d7367f6f51ea7c5ca42a1f8256 Mon Sep 17 00:00:00 2001 From: lixxu Date: Thu, 9 Feb 2017 18:26:17 +0800 Subject: [PATCH] fix bug: netloc always in url if SERVER_NAME defined in config even _external not true --- sanic/sanic.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sanic/sanic.py b/sanic/sanic.py index 7b3e5d22..821c2b89 100644 --- a/sanic/sanic.py +++ b/sanic/sanic.py @@ -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)