Presently, the only way to specify status codes in the various handler helpers that return HTTP responses (such as #respond, #render, #json, or #head) is to specify the raw status code value, expressed as an integer. It would be convenient to be able to specify those response status codes using Rails-esque symbols (with which a lot of developers are used to).
For example, it would be possible to do things like:
class MyHandler < Marten::Handler
def get
respond "It does not work", status: :bad_request)
end
end
Let's add support for specifying such status code symbols as part of the following handler helper methods:
Description
Presently, the only way to specify status codes in the various handler helpers that return HTTP responses (such as
#respond
,#render
,#json
, or#head
) is to specify the raw status code value, expressed as an integer. It would be convenient to be able to specify those response status codes using Rails-esque symbols (with which a lot of developers are used to).For example, it would be possible to do things like:
Let's add support for specifying such status code symbols as part of the following handler helper methods:
#respond
#render
#json
#head