You need both an implicit FlowMaterializer and an implicit
ExecutionContext in scope. I haven't followed the chain to check why those
are needed but basically I keep adding them (one or the other or both)
wherever I have compilation errors and it works. It should be something
related to marshalling, I'll leave the answer to the more expert guys
around here.
val route =
extractFlowMaterializer { implicit mat =>
implicit val ec = mat.executionContext
formFields('color, 'age.as[Int]) { (color, age) =>
complete(s"The color is '$color' and the age ten years ago was ${age - 10}")
}
}
On Tuesday, 26 May 2015 14:35:12 UTC+2, Ian Phillips wrote:
>
> If I try to follow the example from the documentation it doesn't compile.
>
> val route =
> formFields('color, 'age.as[Int]) { (color, age) =>
> complete(s"The color is '$color' and the age ten years ago was ${age
> - 10}")
> }
>
>
> I get the following error:
>
> too many arguments for method formFields: (pdm:
> akka.http.scaladsl.server.directives.FormFieldDirectives.FieldMagnet)pdm.Out
> formFields('color, 'age.as[Int]) { (color, age) =>
> ^
> one error found
>
> Is the documentation wrong, or (more likely) what stupid mistake am I
> making with this? In case it makes a difference here, I'm importing:
>
> import akka.http.scaladsl.server._
> import akka.http.scaladsl.server.Directives._
>
>
> Cheers,
> Ian.
>
--
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.