I want to have the content of result.entity.asString but the result is empty. And I have many WARNING that make non stop. My Code is: `
implicit val system: ActorSystem = ActorSystem("simple-spray-client")
val log: LoggingAdapter = Logging(system, getClass)
val pipeline: SendReceive = sendReceive
val responseFuture: Future[HttpResponse] = pipeline {
Get("https://api.guildwars2.com/v2/items")
}
val re = responseFuture.onComplete {
case Success(result: HttpResponse) => {
result.entity.asString
shutdown()
}
case Failure(error) =>
log.error(error, "Couldn't get list of items")
shutdown()
}
def shutdown(): Unit = {
IO(Http).ask(Http.CloseAll)(1.second).await
system.shutdown()
}}
` the result is:
()
[WARN] [10/27/2015 11:26:04.776] [simple-spray-client-akka.actor.default-dispatcher-4] [akka://simple-spray-client/user/IO-HTTP/group-0/0] Illegal response header: Illegal 'Cache-Control' header: Invalid input '"', expected $timesCache$minusControl (line 1, pos 1):
"public, max-age=300"
^
[WARN] [10/27/2015 11:26:04.779] [simple-spray-client-akka.actor.default- dispatcher-4] [akka://simple-spray-client/user/IO-HTTP/group-0/0] Illegal response header: Illegal 'Access-Control-Expose-Headers' header: Invalid input '"', expected $timesAccess$minusControl$minusExpose$minusHeaders (line 1, pos 1):
"X-Result-Total, X-Result-Count"
^

How about some code clean-up and formatting to start with ? :) (
responseFuture.toString?println(re)?). This would certainly help attracting answers.This being said the request is being triggered by spray. The warnings are about headers in the response. I ran the query and the response headers are:
As you can see the values for
Cache-ControlandAccess-Control-Expose-Headersstart with a double quote, as warned by spray.Now can you try re-implementing as
...and see what is logged at the info level on your console (not sure what logging framework you are using)
Also, checking HTTP response codes before accessing the entity may be a good idea