set scheme to http if not provided

This commit is contained in:
lixxu 2017-09-27 09:59:49 +08:00
parent 4ce699e57f
commit f96ab02767

View File

@ -460,7 +460,10 @@ class Sanic:
if external:
if not scheme:
scheme = netloc[:8].split(':', 1)[0]
if ':' in netloc[:8]:
scheme = netloc[:8].split(':', 1)[0]
else:
scheme = 'http'
if '://' in netloc[:8]:
netloc = netloc.split('://', 1)[-1]