From e70cba51432e85ea49139acaa7019d5ca1ad4001 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 17 Oct 2018 04:12:13 -0700 Subject: [PATCH] Fix for #71 --- responder/api.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/responder/api.py b/responder/api.py index c88766c..904c14a 100644 --- a/responder/api.py +++ b/responder/api.py @@ -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)