Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface is counterintuitive #169

Open
OrderFromChaos opened this issue Mar 12, 2024 · 1 comment
Open

Interface is counterintuitive #169

OrderFromChaos opened this issue Mar 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@OrderFromChaos
Copy link

OrderFromChaos commented Mar 12, 2024

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'}
@cirospaciari
Copy link
Owner

this is because of how uWS was created, I'm redoing the interface. Will keep this open until is finished.

@cirospaciari cirospaciari added the enhancement New feature or request label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants