akka/akka-http

Ability to use custom MediaTypes with `SprayJsonSupport`

Open

#316 aperta il 15 set 2016

Vedi su GitHub
 (2 commenti) (1 reazione) (0 assegnatari)Scala (598 fork)batch import
1 - triagedhackathonhelp wantedt:marshalling

Metriche repository

Star
 (1311 star)
Metriche merge PR
 (Merge medio 1g 10h) (2 PR mergiate in 30 g)

Descrizione

The akka-http / Spray json integration is pretty good, but forces one to get generic application/json output. Use of more specific data types (e.g. application/problem+json) is common, and beneficial. However, I did not find a way to implement that with akka-http 2.4.10.

Suggestion: SprayJsonSupport could take an implicit MediaType parameter, defaulting to application/json.

I will make a local copy of the code and experiment with this approach. Decided to first bring this up as an Issue for discussion - can provide a PR if there's acceptance for such a feature.

https://github.com/akka/akka/blob/0ed4a2aae9ecab43ef806025596a5573ddc883ea/akka-http-marshallers-scala/akka-http-spray-json/src/main/scala/akka/http/scaladsl/marshallers/sprayjson/SprayJsonSupport.scala

Guida contributor