From f96ab027677d525d1a690223d217c27cc05517e9 Mon Sep 17 00:00:00 2001 From: lixxu Date: Wed, 27 Sep 2017 09:59:49 +0800 Subject: [PATCH] set scheme to http if not provided --- sanic/app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sanic/app.py b/sanic/app.py index 3776c915..5d80b360 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -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]