Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The possibility to set custom success response codes #136

Open
jonkri opened this issue Jul 5, 2015 · 4 comments
Open

The possibility to set custom success response codes #136

jonkri opened this issue Jul 5, 2015 · 4 comments

Comments

@jonkri
Copy link

jonkri commented Jul 5, 2015

I would like to be able to return a custom response code upon success, such as setting 303 See Other instead of 200 OK.

Thanks for a nice library!

@hesselink
Copy link
Member

That's a good idea. Do you have any idea how you would like the user API would look for this?

@bergmark
Copy link
Member

bergmark commented Jul 6, 2015

How about having a customResponseCode that introduces a ToResponseCode constraint on the output dictionary?

@hesselink
Copy link
Member

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.

@jonkri
Copy link
Author

jonkri commented Jul 23, 2015

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)}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants