Open jonkri opened 9 years ago
That's a good idea. Do you have any idea how you would like the user API would look for this?
How about having a customResponseCode
that introduces a ToResponseCode
constraint on the output dictionary?
That sounds like a good idea, I'm not sure how it'd work out internally though. If it doesn't, another option would be to have a monadic setResponseCode
inside the handlers. We'd have to change the type for the handlers, though, which is pretty nasty. If we ever do that (we've discussed it before) we should really make it opaque.
setResponseCode
seems like the nicest to work with. The return type of handlers should perhaps be more structured, i.e. data HandlerReturn = HandlerReturn { returnBody :: !ByteString, returnCode :: !Int, returnHeaders :: !(Map HeaderName HeaderValue)}
.
I would like to be able to return a custom response code upon success, such as setting
303 See Other
instead of200 OK
.Thanks for a nice library!