add websocket scheme in request

This commit is contained in:
Jing Su 2017-03-13 13:28:35 +08:00
parent 7d9de068d9
commit 3af26540ec
No known key found for this signature in database
GPG Key ID: D267EFAA88310899

View File

@ -142,6 +142,10 @@ class Request(dict):
@property
def scheme(self):
if self.app.websocket_enabled \
and self.headers.get('upgrade') == 'websocket':
return 'ws'
if self.transport.get_extra_info('sslcontext'):
return 'https'