Skip to content

Conversation

@asheshambasta
Copy link
Collaborator

Needed for the user error response fixes.

May need minor adjustments based on actual use (which I'm working on next).

--

This will let us start servers with the correct mode and respond with
errors in HTML or in JSON, depending on the use case.

A future improvement would be to do this via a middleware: and detect
the mode based off the the client's "Accept" header.

This will let us start servers with the correct mode and respond with
errors in HTML or in JSON, depending on the use case.

A future improvement would be to do this via a middleware: and detect
the mode based off the the client's "Accept" header.
@asheshambasta asheshambasta added the enhancement New feature or request label Jul 10, 2022
@asheshambasta asheshambasta self-assigned this Jul 10, 2022
@asheshambasta asheshambasta requested a review from noteed July 10, 2022 10:17
@noteed
Copy link
Member

noteed commented Jul 15, 2022

This will let us start servers with the correct mode and respond with errors in HTML or in JSON, depending on the use case.

Do you mean something like cty-serve --html and cty-serve --json ?

A future improvement would be to do this via a middleware: and detect the mode based off the the client's "Accept" header.

I think Servant already support detecting the "Accept" header and I've used it here in start-servant:
https://github.com/noteed/start-servant/blob/main/src/Prototype/Server/Legacy.hs#L57

@asheshambasta
Copy link
Collaborator Author

@noteed putting this on hold until further research based on today's discussion.

@noteed noteed force-pushed the main branch 3 times, most recently from 2a544a7 to af29a16 Compare December 12, 2023 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants