-
-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
Methods related to client's request (get_json, get_text, get_data) are inexplicably methods of AppResponse instead of AppRequest. The AppRequest presumably refers to the data sent from the client and is used as such for other client message methods like get_headers, get_cookies, get_url, etc.
Describe the solution you'd like
All methods related to client's request should be part of AppRequest.
Describe alternatives you've considered
Additional context
Minimal example (version 0.0.27):
from socketify import App
async def root(res, req):
print(type(res))
print(await res.get_json())
res.end("Hello World socketify from Python!")
app.post('/', root)
app.listen(17999, lambda config: print("Listening on port http://localhost:%d now\n" % config.port))
app.run()Then:
curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST http://localhost:17999/
Which gives:
Listening on port http://localhost:17999 now
<class 'socketify.socketify.AppResponse'>
{'key1': 'value1', 'key2': 'value2'}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request