Nice, thanks! More examples, explanations and learning materials are very 
welcome for akka-http, to make it more approachable.

Btw, some simplification of usage for http-client would help, too. 
Internally we came up with something like:

trait HttpClient {
implicit def system: ActorSystem
implicit def materializer: ActorMaterializer
def connectionContext: HttpsConnectionContext
protected val http = Http()
//execs only if result was successful
def exec[T, U](r: HttpRequest, f: U => T)(implicit u: Unmarshaller[
HttpResponse, U], ec: ExecutionContext): Future[T] =
http.singleRequest(r).flatMap(u.apply(_).map(f))
//execs only if result was successful
def execOK[T, U](r: HttpRequest, f: U => T)(implicit u: Unmarshaller[
HttpResponse, U], ec: ExecutionContext): Future[T] =
http.singleRequest(r).flatMap { rsp =>
if (rsp.status.isSuccess()) u.apply(rsp).map(f)
else Unmarshal(rsp.entity).to[String].flatMap(str => Future.failed[T](
SgHttpError(rsp.status.intValue(), str)))
}
}

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to