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

ctx.request.form empty on version 2.0.2 #20

Closed AlbertoOS closed 7 years ago

AlbertoOS commented 7 years ago
from kyoukai import Kyoukai
app = Kyoukai("app")

@app.route("/test", methods=["POST"])
async def test(ctx):
    print(ctx.request.form)

app.run()

Testing with a request requests.post('http://localhost:4444/test', json={'message': 'test'}) gives me ImmutableMultiDict([]) on version 2.0.2 but on version 1.9.2.1 it works and displays {'message': 'test'}.

Fuyukai commented 7 years ago

I don't think Werkzeug parses the body as form data when it's passed as json.

You can probably use get_data to get the body data then manually load it for now. I'll add a custom form data parser that runs on content-type application/json.

Fuyukai commented 7 years ago

Latest commit should allow this. Untested, please let me know if it breaks.