Fuyukai / Kyoukai

[OLD] A fully async web framework for Python3.5+ using asyncio
https://mirai.veriny.tf
MIT License
298 stars 14 forks source link

POST method not receiving ctx #18

Closed Martmists-GH closed 7 years ago

Martmists-GH commented 7 years ago
# code
@app.route("/my/route", methods=["POST"])
async def myroute(ctx):
    # more code

# Error
ERROR:Kyoukai:Unhandled exception in route function
ERROR:Kyoukai:Route takes 1 args, passed in 0 instead
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/kyoukai/app.py", line 251, in process_request
    result = await matched.invoke(ctx, params)
  File "/usr/local/lib/python3.5/dist-packages/kyoukai/route.py", line 160, in invoke
    self.check_route_args(params)
  File "/usr/local/lib/python3.5/dist-packages/kyoukai/route.py", line 117, in check_route_args
    raise TypeError("Route takes {} args, passed in {} instead".format(f_nargs, len(params)))
TypeError: Route takes 1 args, passed in 0 instead
Fuyukai commented 7 years ago

Cannot reproduce.

# code
from werkzeug.wrappers import Response

from kyoukai import Kyoukai

app = Kyoukai("aaa")

@app.route("/my/route", methods=["POST"])
async def myroute(ctx):
    return Response("heck", status=400)

app.run()
INFO:asphalt.core.runner:Starting application
INFO:Kyoukai:Kyoukai serving on 127.0.0.1:4444.
INFO:asphalt.core.runner:Application started
INFO:Kyoukai:POST /my/route - 400
Martmists-GH commented 7 years ago

Found the issue. I had two different routes with the same coro name.