I am getting a couple of errors trying to build a simple pipeline that adds a header and does a post
[error] /Users/eweise/workspace/block-reporter-cell/src/main/scala/com/messagebus/block/app/Poster.scala:91: could not find implicit value for parameter aux: spray.httpx.TransformerAux[spray.http.HttpRequest,scala.concurrent.Future[spray.http.HttpResponse],spray.http.HttpRequest,spray.http.HttpRequest,R]
[error] sendReceive ~> addHeader("X-My-Special-Header", "fancy-value")
[error] ^
[error] /Users/eweise/workspace/block-reporter-cell/src/main/scala/com/messagebus/block/app/Poster.scala:97: could not find implicit value for evidence parameter of type spray.httpx.marshalling.Marshaller[com.messagebus.block.model.Block]
[error] Await.result(pipeline(Post("blocks", item)), 10000 millis)
[
My code looks like;
object BlockJsonProtocol extends DefaultJsonProtocol {
implicit val orderFormat = jsonFormat3(Block)
}
class Poster extends Logging {
import spray.http._
import scala.concurrent.duration._
import akka.actor.ActorSystem
import spray.client.pipelining._
import scala.concurrent.duration._
import TransformerAux._
import spray.client.pipelining._
implicit val system = ActorSystem()
implicit val timeout = Timeout(20 seconds)
import system.dispatcher
val pipeline: HttpRequest => Future[HttpResponse] = (sendReceive ~> addHeader("X-My-Special-Header", "fancy-value"))
def handle(item: Block) = {
import BlockJsonProtocol._
Await.result(pipeline(Post("blocks", item)), 10000 millis)
}
}
Can anyone tell me what I'm doing wrong or point me to an example that adds a header and does a post? I'm finding this DSL extremely difficult to use so if anyone can show me a more straightforward way to do a simple post without all the magic I would greatly appreciate it.
Eric