akka/akka-http
Vedi su GitHubAdd a marshalling example to "HttpRequest and HttpResponse / Processing responses" documentation
Open
#2842 aperta il 1 dic 2019
1 - triagedhackathonhelp wantedt:clientt:docst:marshalling
Metriche repository
- Star
- (1311 star)
- Metriche merge PR
- (Merge medio 1g 10h) (2 PR mergiate in 30 g)
Descrizione
In the documentation page on creating HTTP requests with akka-http client functionality, it would be extremely valuable if there was an example on how to include a marshalable object as a request entity. E.g.
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import spray.json.DefaultJsonProtocol._
import akka.http.scaladsl.marshalling.Marshal
case class Pet(name: String)
implicit val petFormat = jsonFormat1(Pet)
for {
entity <- Marshal[Pet("Mamon").to[RequestEntity]
request <- HttpRequest(
method = HttpMethods.POST,
uri = "https://userservice.example/users",
entity = entity
)
} yield request
I have not made a pull request for this as I wouldn't be able to provide a Java version anyway.
There is a documentation page about using marshallers, but it would be very handy to have those two pieces of information presented together.