Compare commits

..

4 Commits

Author SHA1 Message Date
kennethreitz 72adb13c0f version 2018-10-17 04:16:22 -07:00
kennethreitz ea0e382f82 test for #71 2018-10-17 04:15:36 -07:00
kennethreitz e70cba5143 Fix for #71 2018-10-17 04:12:13 -07:00
kennethreitz 8aec244c31 openapi 2018-10-17 04:12:03 -07:00
5 changed files with 21 additions and 4 deletions
+3
View File
@@ -1,3 +1,6 @@
# v0.0.9
- Bugfix for async class-based views.
# v0.0.8
- GraphiQL Support.
- Improvement to route selection.
+1
View File
@@ -55,6 +55,7 @@ Features
- Mutable response object, passed into each view. No need to return anything.
- Background tasks, spawned off in a ``ThreadPoolExecutor``.
- GraphQL (with *GraphiQL*) support!
- OpenAPI schema generation.
Testimonials
------------
+1 -1
View File
@@ -1 +1 @@
__version__ = "0.0.8"
__version__ = "0.0.9"
+5 -3
View File
@@ -203,10 +203,12 @@ class API:
pass
# Then on_get.
method = req.method.lower()
method = req.method
try:
getattr(view, f"on_{method}")(req, resp)
r = getattr(view, f"on_{method}")(req, resp)
if hasattr(r, 'send'):
await r
except AttributeError:
pass
else:
@@ -279,7 +281,7 @@ class API:
return req.text
async def graphql_response(self, req, resp, schema):
show_graphiql = req.method.lower() == "get" and req.accepts("text/html")
show_graphiql = req.method == "get" and req.accepts("text/html")
if show_graphiql:
resp.content = self.template_string(GRAPHIQL, endpoint=req.url.path)
+11
View File
@@ -348,3 +348,14 @@ def test_mount_wsgi_app(api, flask, session):
r = session.get("http://;/flask")
assert r.ok
def test_async_class_based_views(api, session):
@api.route("/")
class Resource:
async def on_post(self, req, resp):
resp.text = await req.text
data = "frame"
r = session.post(api.url_for(Resource), data=data)
assert r.text == data