-
Notifications
You must be signed in to change notification settings - Fork 222
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
Support multiple content-types per service #575
Comments
My most recent idea is to try to attach content-type to trait Endpoint[A] {
type ContentType
} But keep When composing two endpoints, the content-type will turn into a coproduct so we can expect one-by-one mapping. Given that JSON is going to be a default, we can keep the API unchanged but mark |
I wonder how people feel about the following syntax: val getUsers = post[Application.Json]("users" :: body[Application.Json].as[User]) {
Ok("users")
} Making content-type a type member on Not sure this is super readable though, but this is the only thing I can think of today. |
If I assume that |
I'm throwing this into the 0.16 milestone. The idea is to ship something similar to #583 (as an experimental API) and see if gets some adoption. |
The easies solution would be to introduce a wrapper around
Endpoint
that captures two types - its underlying type and a content type. Something like:I think we have to keep in mind that at some point we will introduce content-type member for decoder and I guess there should be a symmetric variant of
respond
for that.The text was updated successfully, but these errors were encountered: