[akka-user] Akka HTTP POST accepted media types

2016-03-19 Thread Christian Pérez-Llamas
Hi, I am doing my first steps with Akka HTTP with no previous experience with Spray. I need to implement a POST that can accept either *text/plain* or *application/json* and returns *application/json*. I am using akka-http-json library for

Re: [akka-user] Akka HTTP POST accepted media types

2016-03-19 Thread Konrad Malawski
Ah yes :-) Agreed and that's because of what I hinted at "things can be improved, will follow up" in the first email :-) Effectively the response you want is indeed produced by Akka, however only when content negotiation is left up to Akka, whereas you basically did it manually (i.e. if doesnt

Re: [akka-user] Akka HTTP POST accepted media types

2016-03-19 Thread Christian Pérez-Llamas
Hi, sorry, I was asking too many things and not being clear. I am doing a curl with an intentionally unsupported content-type to see the response in those cases. I was expecting something more specific such as: HTTP/1.1 415 Unsupported Media Type The request's Content-Type is not supported.

Re: [akka-user] Akka HTTP POST accepted media types

2016-03-18 Thread Christian Pérez-Llamas
Thanks Konrad, looking forward for your example. Meanwhile I just discovered how to use reject() to be more specific, like: reject(UnsupportedRequestContentTypeRejection(Set( MediaTypes.`text/plain`, ContentTypes.`application/json` ))) On Friday, 18 March 2016 12:29:30 UTC, Konrad Malawski