encode / apistar

The Web API toolkit. 🛠
https://docs.apistar.com
BSD 3-Clause "New" or "Revised" License
5.57k stars 411 forks source link

POST async routes with payloads are broken #616

Closed Jenselme closed 5 years ago

Jenselme commented 6 years ago

Hi,

If I use ASyncApp with post routes that take as input a types.Type, the route will timeout. From what I see, the view function is never hit.

Minimal app.py to reproduce.

from apistar import ASyncApp, Route, types, validators

class Hello(types.Type):
    hi = validators.String()

# Times out
async def post(hello: Hello) -> dict:
    print(hello)
    return {'success': True}

# Works
async def simple_post() -> dict:
    return {'success': True}

routes = [
    Route('/post', 'POST', post),
    Route('/simple_post', 'POST', simple_post),
]

app = ASyncApp(routes=routes)

if __name__ == '__main__':
    app.serve('127.0.0.1', 7000, debug=True)
Jenselme commented 6 years ago

Forgot to precise when I opened the ticket: I tested with version 0.5.41

ZhouBox commented 6 years ago

I also found when I user POST, the http call will no return. I also use ASyncApp on 0.5.41。

ZhouBox commented 5 years ago

https://github.com/encode/apistar/pull/622

tomchristie commented 5 years ago

Closing this off given that 0.6 is moving to a framework-agnostic suite of API tools, and will no longer include the server. See https://discuss.apistar.org/t/api-star-as-a-framework-independant-tool/614 and #624.