1

I have a pipeline:

import spray.httpx.unmarshalling._
import spray.client.pipelining._
import spray.json._
import MyJsonProtocol._ //which defines a formatter for MyCustomType
import spray.http._
import spray.httpx.SprayJsonSupport._

val pipeline = sendReceive ~> unmarshal[MyCustomType]

Compiler says that he can't find implicit value for parameter unmarshaller: spray.httpx.unmarshalling.FromResponseUnmarshaller[MyCustomType]

I've done it like in the sample in spray doc here. Why can not it resolve implicits?

EDIT val pipeline = sendReceive ~> unmarshal[MyCustomType] is used from method of anonymous class. I figured out that if I declare all my jsonFomats in that anonymous class(I mean stuff that resides in MyJsonProtocol I replace to anonymous class) everything works fine.

So question is why this does not work with anonymous classes?

maks
  • 5,911
  • 17
  • 79
  • 123

1 Answers1

1

Try to specify the type of the value pipeline:

val pipeline: HttpRequest => Future[MyCustomType] = sendReceive ~> unmarshal[MyCustomType]