add host test

This commit is contained in:
Suby Raman 2017-03-03 14:51:13 -05:00
parent f0e818a28c
commit e792a1e030
2 changed files with 2 additions and 2 deletions

View File

@ -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` - `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` - `scheme`: The URL scheme associated with the request: `http` or `https`
- `host`: The host associated with the request: `localhost:8080` - `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 `''` - `query_string`: The query string of the request: `foo=bar` or a blank string `''`

View File

@ -149,7 +149,7 @@ class Request(dict):
def host(self): def host(self):
# it appears that httptools doesn't return the host # it appears that httptools doesn't return the host
# so pull it from the headers # so pull it from the headers
return self.headers['Host'] return self.headers.get('Host', '')
@property @property
def path(self): def path(self):