bananaml / banana-cli

Apache License 2.0
21 stars 3 forks source link

Return response seems a bit verbose #9

Closed djt closed 1 year ago

djt commented 1 year ago

Just leaving this here for a discussion point. The return response below seems like extra boilerplate.

return Response(status, json)

My perfect solution would be to:

Normal success response return {'key': 'value'}

Verbose success response return {'key': 'value'}, 200

Custom status response return {'error': 'Not Found'}, 404

erik-dunteman commented 1 year ago

Thanks!

We'd like to keep it to Response, even if a bit verbose, to keep the handlers consistent in interface, so we can have the decorators be more portable between functions, and allow for custom middleware

erik-dunteman commented 1 year ago

I also realize now that this issue is better suited for the Potassium repo