-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
Hi!
I'm using Picoweb and it's great. However, I'm feeling that it lacks of some minor features and convenience methods. I'm working on these features as I need them in my project, and I think my work or ideas might be useful to improve Picoweb. These are my thoughts so far:
- Request method filtering. Flask uses the
route()function for it. I've created a decorator function to handle this. - Manage exceptions in views. Although Picoweb handles the exceptions, I like to send a custom (500) response. Right now I am using the same
methodsdecorator that I created, although it is not an ideal solution. - A simple response class or method to avoid using the StreamWriter directly. I've created a Response class to send simple
text/htmlandapplication/jsonresponses. I've also created a subclass that format the response based on the JSend specification, although this is a very personal feature. - I miss a
bodyattribute in the request object (or aread()method), although there is aread_form_data()method (only useful with web forms). Ajson()method would also be great :) - If a request has some body content but it is not read in the view (it may be not necessary), then the server doesn't send any response. That's why I think a
bodyattribute could also help to empty and close the reader stream before the handler is called.
I've solved all of these needs, and I can adapt my code into Picoweb and make a few pull requests. However, I wanted to know what do you think about these features and if it makes sense to include them into the library.
Thank you, and sorry if my English doesn't make sense sometimes...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels