add __repr__ for sanic request

This commit is contained in:
huyuhan 2017-09-15 21:05:25 +08:00
parent 77f70a0792
commit f6eb35f67d

View File

@ -71,8 +71,10 @@ class Request(dict):
def __repr__(self):
if self.method is None or not self.path:
return '<%s>' % self.__class__.__name__
return '<%s: %s %s>' % (self.__class__.__name__, self.method, self.path)
return '<{class_name}>'.format(class_name=self.__class__.__name__)
return '<{class_name}: {method} {path}>'.format(class_name=self.__class__.__name__,
method=self.method,
path=self.path)
@property
def json(self):