Replies: 1 comment 1 reply
-
The normal way you return an empty response is with I think it is feasible to support |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been writing a small app (Auth framework for nginx) which has a number of routes which meaningfully return only a response code (eg 200 or 403).
Very foolishly, I got a little stuck, having assumed that I could
return 200
from a route, and accept that the documentation is pretty clear that a text or bytes content is needed as the first value, with the response code being the second returned value in order to achieve what I am attempting, if I don't want to create a response object myself.Thusly
return "foo", 200
is entirely suitable for my requirements.However, I did wonder if:
a) A single return value of an integer could be accepted as the response code, with an empty body
b) The error returned in such a situation could be improved (it does declare that a bytes object was expected rather than an int, but this error could be caught earlier and more clearly to the less savvy programmer).
I further accept that very few people will be wanting to sent empty responses with manipulation of only the response code.
However, such is my suggestion today.
Thanks as always, Miguel.
Beta Was this translation helpful? Give feedback.
All reactions