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
1
vote
1 answer

How to enable HTTP Pipelining with Spray-Can

I read on the spray-can docs that it supports HTTP Pipelining. But there is no method or example specified anywhere on how to do it.
MeetM
  • 1,410
  • 17
  • 25
1
vote
1 answer

How to make a persistent HTTP Connection using Spray-Client

I am trying to request a persistent HTTP Connection using Scala Spray-client library such that the client has to establish the connection once and then it can make multiple calls on the same connection. I am not able to find any information for this…
emotionull
  • 595
  • 2
  • 8
  • 24
1
vote
1 answer

Marshalling custom case class using Scala Spray httpx

i'm trying to marshall a string into a custom case class that I have. Here is the code I am trying to use import spray.httpx.SprayJsonSupport._ import NflWeekJsonProtocol._ path("playerScore") { get { parameters('gsisId.as[String]…
Chris Stewart
  • 1,641
  • 2
  • 28
  • 60
1
vote
1 answer

Json media types for requests in Scala Spray

I have a simple json app. It works fine if I make a request like curl -X POST --data "userId=1" http://localhost:8080/register But request fails when I try to make a json request, e.g. curl -v -H "Content-type: application/json" -X POST -d…
kikulikov
  • 2,512
  • 4
  • 29
  • 45
1
vote
0 answers

ClassCastException in Spray Client

Getting following Error - java.lang.ClassCastException: Cannot cast akka.io.Tcp$ErrorClosed to spray.http.HttpResponse at java.lang.Class.cast(Class.java:3369) ~[na:1.8.0_45] at…
Arpit
  • 227
  • 5
  • 15
1
vote
1 answer

Spray http client and thousands requests

I want to configure spray http client in a way that controls max number of request that were sent to the server. I need this because server that i'm sending requests to blocks me if there are more then 2 request were sent. I…
Alexander Kondaurov
  • 3,677
  • 5
  • 42
  • 64
1
vote
1 answer

Using spray with "chunked responses"

I am using Spray to query a REST endpoint which will return a largish amount of data with several items that should be processed. The data is a series of json objects. Is there a way to convert the response into a stream of these objects that doesn…
Emil L
  • 20,219
  • 3
  • 44
  • 65
1
vote
1 answer

Unmarshaller implcit resolution in spray-client

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 =…
maks
  • 5,911
  • 17
  • 79
  • 123
1
vote
2 answers

Posting JSON message with no key value pair Spray

Here is an example of what I am trying to post to web service: Content-Type: application/json …
Chris Stewart
  • 1,641
  • 2
  • 28
  • 60
1
vote
1 answer

Illegal response header Scala Spray pipelining

I'm getting the follow error when I am trying to pipeline a request from Scala spray [play-akka.actor.default-dispatcher-14] INFO application - Pipelining chain request [WARN] [03/19/2015 11:08:49.115] [application-akka.actor.default-dispatcher-2]…
Chris Stewart
  • 1,641
  • 2
  • 28
  • 60
1
vote
0 answers

spray-testkit: could not find implicit value for parameter ta:

First time spray user close to ripping hair out. trait SampleService extends SimpleRoutingApp with JsonProtocol with SprayJsonSupport { implicit val system: ActorSystem = ActorSystem("test") implicit def context: ExecutionContext =…
flavian
  • 28,161
  • 11
  • 65
  • 105
1
vote
2 answers

Using spray client (sendReceive) within an actor

The use case is this: An Actor is bind to spray IO - receiving and handling all inbound HTTP requests coming through a specified port. For each inbound request the actor needs to send an outbound asynchronous http request to a different external…
joel
  • 61
  • 5
1
vote
1 answer

Unmarshalling error onFailure from http POST with spray.client

I am very new to spray.io and scala for that matter, so I apologize in advance if I didn't get the terminology right here in regards to unmarshalling. I'm trying to get my hands on a HTTP POST response using a pipeline, it's expected to fail because…
Stefan Konno
  • 1,337
  • 2
  • 16
  • 28
1
vote
1 answer

Location header is lost if max-redirects > 1

I have the following set-up: val req = HttpRequest(HttpMethods.GET, Uri("http://www.example.com/blah")) val response: Future[HttpResponse] = (IO(Http) ? req).mapTo[HttpResponse] response.map( resp => { resp.headers.foreach(h…
Tim
  • 2,008
  • 16
  • 22
1
vote
0 answers

Sending a POST Message from an akka Actor with case class message fails

I'd like to make a web request using the spray client out of an actor this web request requires a parameter which has to be part of the receiving message. In order to do this I created a case class like: case class MessageWithParam(param:…
Akira
  • 83
  • 5