mirror of
https://github.com/kennethreitz/responder.git
synced 2026-06-05 14:50:19 +00:00
Merge branch 'master' of github.com:kennethreitz/responder
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ coverage.xml
|
||||
|
||||
__pycache__
|
||||
tests/__pycache__
|
||||
|
||||
*.pyc
|
||||
build
|
||||
responder.egg-info/
|
||||
dist/
|
||||
|
||||
@@ -185,7 +185,7 @@ WebSocket Support
|
||||
|
||||
Responder supports WebSockets::
|
||||
|
||||
@api.ws_route('/ws')
|
||||
@api.route('/ws', websocket=True)
|
||||
async def hello(ws):
|
||||
await ws.accept()
|
||||
await ws.send_text("Hello via websocket!")
|
||||
|
||||
+3
-2
@@ -77,8 +77,9 @@ class Route:
|
||||
def is_class_based(self):
|
||||
return hasattr(self.endpoint, "__class__")
|
||||
|
||||
@property
|
||||
def is_function(self):
|
||||
routed = hasattr(self.endpoint, "is_routed")
|
||||
is_callable = callable(self.endpoint)
|
||||
code = hasattr(self.endpoint, "__code__")
|
||||
kwdefaults = hasattr(self.endpoint, "__kwdefaults__")
|
||||
return all((routed, code, kwdefaults))
|
||||
return all((is_callable, code, kwdefaults))
|
||||
|
||||
Reference in New Issue
Block a user