From e792a1e030add49650f9f5f8d4803d4f7c6bfcba Mon Sep 17 00:00:00 2001 From: Suby Raman Date: Fri, 3 Mar 2017 14:51:13 -0500 Subject: [PATCH] add host test --- docs/sanic/request_data.md | 2 +- sanic/request.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sanic/request_data.md b/docs/sanic/request_data.md index 7a2a0a3d..a86a0f21 100644 --- a/docs/sanic/request_data.md +++ b/docs/sanic/request_data.md @@ -88,7 +88,7 @@ The following variables are accessible as properties on `Request` objects: - `url`: The full URL of the request, ie: `http://localhost:8000/posts/1/?foo=bar` - `scheme`: The URL scheme associated with the request: `http` or `https` - `host`: The host associated with the request: `localhost:8080` -- `path`: The path of the request: `/posts/1`/ +- `path`: The path of the request: `/posts/1/` - `query_string`: The query string of the request: `foo=bar` or a blank string `''` diff --git a/sanic/request.py b/sanic/request.py index 2f5571da..9635952b 100644 --- a/sanic/request.py +++ b/sanic/request.py @@ -149,7 +149,7 @@ class Request(dict): def host(self): # it appears that httptools doesn't return the host # so pull it from the headers - return self.headers['Host'] + return self.headers.get('Host', '') @property def path(self):