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

Surprising server behaviour? #1017

Closed
alpmestan opened this issue Jul 28, 2018 · 3 comments
Closed

Surprising server behaviour? #1017

alpmestan opened this issue Jul 28, 2018 · 3 comments

Comments

@alpmestan
Copy link
Contributor

https://github.com/revskill10/circle-haskell/blob/html/core/Lib.hs
(the route for GraphQL is at Handlers/Json/GraphQL.hs)

(by revskill on #haskell)

@revskill10
Copy link

revskill10 commented Jul 28, 2018

Thanks @alpmestan for raising this issue up.
My intent is to get a graphql-like API, so that my client functions could get the dynamic type behaviours based on request body only.
Current issue is that, Servant always failed at first parse and never try next alternatives.
Why do i want this behaviour ?
Because it's nonsense to prepend stringly routes (naming is HARD) just to make this kind of API more dynamic.

@phadej
Copy link
Contributor

phadej commented Feb 9, 2019

This isn't good question, see e.g. https://stackoverflow.com/help/how-to-ask

(Yes, I'm aggressively closing stale questions issues; maybe you should try your luck on stack overflow?)

And FWIW, servant unfortunately cannot route based on ReqBody contents (it can on its content-type IIRC). This because ReqBody is very general, and may include large bodies (ideally we'll unify ReqBody and StreamBody and let the data type decide).

What you can do, is to write own ReqBody-like combinator.

Note that request body can be consumed only once

@phadej phadej closed this as completed Feb 9, 2019
@phadej
Copy link
Contributor

phadej commented Feb 9, 2019

Related #1120

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

No branches or pull requests

3 participants