Questions tagged [spray-client]

Spray-client provides high-level HTTP client functionality by adding another logic layer on top of the relatively basic spray-can HTTP Client APIs. It doesn’t yet provide all the features that we’d like to include eventually, but it should already be of some utility for many applications.

Spray-client provides high-level HTTP client functionality by adding another logic layer on top of the relatively basic spray-can HTTP Client APIs. It doesn’t yet provide all the features that we’d like to include eventually, but it should already be of some utility for many applications.

Currently it allows you to wrap any one of the three spray-can client-side API levels with a pipelining logic, which provides for:

- Convenient request building
- Authentication
- Compression / Decompression
- Marshalling / Unmarshalling from and to your custom types
71 questions
3
votes
1 answer

Parsing HTML with Spray

I get an exception The entity “nbsp” was referenced, but not declared when parsing valid HTML that contains the   entity (which makes it invalid XML; I do not control the server) while unmarshalling a HttpEntity into a NodeSeq with…
kliew
  • 3,073
  • 1
  • 14
  • 25
3
votes
1 answer

Spray unmarshalling generic type

I'm using spray-client to generate http requests to my server in e2e tests. I also use specs2 to test for the desired response from the server. And everything works fine. I've built some custom specs2 matchers to simplify my test code. My test looks…
anatolyr
  • 217
  • 1
  • 10
3
votes
3 answers

How to define SSLContext with Spray https client?

I want to post http requests to a secured server with a given ca cert. I'm using Spray 1.3.1, the code looks something like this: val is = this.getClass().getResourceAsStream("/cacert.crt") val cf: CertificateFactory =…
joel
  • 61
  • 5
3
votes
1 answer

[Spray Client]: Facebook graph API returning wrong contentype

Staring with the Spray Library I tried to make a request to the Facebook Graph API: val responseF: Future[HttpResponse] = pipeline(Get("http://graph.facebook.com/v2.1/facebook/picture?redirect=false")) def receive = { case _ => val…
Aranir
  • 828
  • 1
  • 10
  • 21
3
votes
1 answer

Using the Http headers to unmarshall a response with spray-client

I'm using spray-client to access a REST service. Part of the data returned by the server is in the http response headers (the rest is in the response body). In order to be able to unmarshall the response, I am using an Unmarshaller. However, the…
paradigmatic
  • 40,153
  • 18
  • 88
  • 147
2
votes
4 answers

how can have the body of http response spray scala

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,…
timo 123
  • 21
  • 1
  • 3
2
votes
0 answers

Spray Client for Jenkins hangs waiting for large response

I'm writing a Spray client for the Jenkins build server. I can query a project with up to 18 build results but a project with 31 has the behaviour that my client never receives the response. I can do this successfully with curl so I'm at a loss for…
Sarge
  • 2,367
  • 2
  • 23
  • 36
2
votes
1 answer

How do I set a non-standard User-Agent using spray-client?

I'm building an application for a Telco, using Scala and Akka, and need to communicate with Account Information and Refill servers using the UCIP protocol. UCIP is a simple protocol, built on XMLRPC; the only issue I'm having is that it requires…
elo80ka
  • 14,837
  • 3
  • 36
  • 43
2
votes
2 answers

Getting file name from POST request in Spray-can

I am using Spray-can to host a REST service to which a user will be able to upload a file. The block of code that listens for incoming requests is given below: def receive: Receive = { case _: Http.Connected => sender ! Http.Register(self) case…
James Isaac
  • 2,587
  • 6
  • 20
  • 30
2
votes
1 answer

spray-client throwing "Too many open files" exception when giving more concurrent requests

I have a spray http client which is running in a server X, which will make connections to server Y. Server Y is kind of slow(will take 3+ sec for a request) This is my http client code invocation: def get() { val result = for { response…
Yoda
  • 442
  • 3
  • 14
2
votes
2 answers

Spray-client sendReceive throws SSLHandshakeException

I am trying to make spray-client connect using https to restricted rest api. The problem is that the certificate of the remote server is not registered as trusted, the simple Get() connection is then refused with SSLHandshakeException and I struggle…
Matej Briškár
  • 599
  • 4
  • 17
2
votes
1 answer

How to unmarshall a list of case class in Spray

First time Spray user failing to find any proper examples on this anywhere. I'm looking to unmarshall the XML API response that contains a List[Person]. Say case class Person(name: String, age: Int). The unmarshaller should produce the appropriate…
flavian
  • 28,161
  • 11
  • 65
  • 105
2
votes
0 answers

spray-client: log the actual HTTP sent / recieved over the wire

In Apache HTTP Client there's the concept of a "wire log" that can be turned on, printing out the actual HTTP text generated by the client code and sent to the server. How can I do the same using spray-client? I'm of course able to add a…
Electric Monk
  • 2,192
  • 2
  • 23
  • 33
1
vote
1 answer

Why does mapTo fail in Akka HTTP client?

I have a Akka HTTP service which returns a string, as shown below: val route1: Route = { path("hello") { get{ complete{ println("Inside r1") "You just accessed hello" } } } } I have a Akka HTTP…
codingsplash
  • 4,785
  • 12
  • 51
  • 90
1
vote
1 answer

Spray not setting Content-Type header for FormData

FormData is supposed to set the Content-Type header automatically but it isn't working. So I tried to set it manually but I get a warning. val gzipPipeline: HttpRequest => Future[HttpResponse] = encode(Gzip) ~> sendReceive ~> decode(Gzip) val…
kliew
  • 3,073
  • 1
  • 14
  • 25