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

Error modes. #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

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.

2 participants