This is the code from https://github.com/eigengo/activator-spray-twitter/blob/master/src/main/scala/core/tweetstream.scala
What does ~> (tilde arrow) mean? I think it should be an HttpRequest statement, but I could not find such a statement in the API.
I can understand that authorize is a function that returns (HttpRequest => HttpRequest), so val rq should be HttpRequest, which returned a value after applying the returned authorization function.
def receive: Receive = {
case query: String =>
val body = HttpEntity(ContentType(MediaTypes.`application/x-www-form-urlencoded`), s"track=$query")
val rq = HttpRequest(HttpMethods.POST, uri = uri, entity = body) ~> authorize
sendTo(io).withResponsesReceivedBy(self)(rq)
case ChunkedResponseStart(_) =>
case MessageChunk(entity, _) => TweetUnmarshaller(entity).fold(_ => (), processor !)
case _ =>
}
Thanks in advance!
source
share