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
34
votes
1 answer

How to fix the Dropping Close since the SSL connection is already closing error in spray

I’m making a call to an API, but most of the time I keep getting an error: “Dropping Close since the SSL connection is already closing” and “Premature connection close (the server doesn't appear to support request pipelining).” Like 90% of the time…
maya.js
  • 1,147
  • 12
  • 25
15
votes
2 answers

How to mock spray-client response

I have a simple spray client : val pipeline = sendReceive ~> unmarshal[GoogleApiResult[Elevation]] val responseFuture = pipeline {Get("http://maps.googleapis.com/maps/api/elevation/jsonlocations=27.988056,86.925278&sensor=false") } responseFuture…
Eleni
  • 645
  • 6
  • 19
14
votes
1 answer

Cannot find an implicit ExecutionContext. You might pass spray scala

I have this two erros: Error:(39, 20) Cannot find an implicit ExecutionContext. You might pass an (implicit ec: ExecutionContext) parameter to your method or import scala.concurrent.ExecutionContext.Implicits.global. val pipeline = sendReceive …
kam kimo
  • 193
  • 1
  • 2
  • 7
10
votes
2 answers

Throttle HTTP request on Akka/Spray

I'm using Akka actors in Scala to download resources from external service (HTTP get request). Response from external service is JSON and I have to use paging (provider is very slow). I want to download all paged results concurrently in 10 threads.…
KrzyH
  • 4,256
  • 1
  • 31
  • 43
10
votes
2 answers

Can I set a timeout and number of retries on a specific pipeline request?

When using spray's pipelining to make an HTTP request like this: val urlpipeline = sendReceive ~> unmarshal[String] urlpipeline { Get(url) } is there a way to specify a timeout for the request and the number of times it should retry for that…
Scott Smith
  • 103
  • 1
  • 6
6
votes
1 answer

akka timeout when using spray client for multiple request

Using spray 1.3.2 with akka 2.3.6. (akka is used only for spray). I need to read huge files and for each line make a http request. I read the files line by line with iterator, and for each item make the request. It run successfully for some of the…
roterl
  • 1,883
  • 14
  • 24
6
votes
1 answer

Spray Client Post Multipart

I want to use Spray to post to a server a multipart form. In particular I want to post an Image. What Im having trouble with is the Marshalling of the File to Multipart. Even though in Spray they mention its a default Marshaller, I just cant seem to…
dgrandes
  • 1,187
  • 2
  • 14
  • 28
5
votes
1 answer

Postman gives error for REST based POST methods

I am using POSTMAN app for doing REST call (POST, GET) to my Scala Akka Application. if i do the same call from angularJS it works but when i fire it from POSTMAN it gives following error : There was a problem with the requests…
Nilesh
  • 2,054
  • 3
  • 23
  • 43
5
votes
1 answer

Why akka-http Unmarshaler returns Future[T] instead of T?

Since documentation is not ready I'll ask akka maintainers here. Why akka-http Unmarshaler returns Future[T] instead of T ? Here is my goal. I want to unmarshal class from XML http response similarly how it's done for json. For example I'd like to…
expert
  • 29,290
  • 30
  • 110
  • 214
5
votes
0 answers

How to track progress of medium-sized file download using Spray Client in Scala

I am trying to use Spray to download a medium-sized file, say a video, from my Scala app. What I need is to download the file and, for every chuck that I receive (possibly the chuck dimension is something I would set via config), to track the…
mdm
  • 3,928
  • 3
  • 27
  • 43
4
votes
1 answer

spray-client upload form with file

I have a next form:
I want to send…
lito
  • 989
  • 8
  • 21
4
votes
1 answer

Spray-Test gzip decode

I try write test for spray class FullTestKitExampleSpec extends Specification with Specs2RouteTest with UserController with HttpService { def actorRefFactory = system "The service" should { "return a greeting for GET requests to the root…
Rinat Mukhamedgaliev
  • 5,401
  • 8
  • 41
  • 59
4
votes
1 answer

how can spray.io work with scala 2.11.1 akka 2.3.2

I want to use spray.io with scala 2.11.x akka 2.3.x, and I find the following in the Project Info page of spray.io: spray 1.3.1 is built against Scala 2.10.3 and Akka 2.3.0 as well as Scala 2.11.1 and Akka 2.3.2. When I use spray-client, I meet…
宇宙人
  • 1,197
  • 3
  • 10
  • 28
4
votes
3 answers

Spray client - treat response with unexpected content-type as application/json?

When I try to GET amazon identity data like that val pipeline: HttpRequest => Future[IdentityData] = sendReceive ~> unmarshal[IdentityData] pipeline(Get("http://169.254.169.254/latest/dynamic/instance-identity/document")) with appropriate case…
eugen-fried
  • 2,111
  • 3
  • 27
  • 48
3
votes
0 answers

Akka stream - handling async out-of-stream retries

I am trying to have an Akka stream where some of the stages are http calls. Since the http calls can (and will) fail at times, I would prefer to put relevant data to a separate queue (might even be external to my application), pull them after some…
anindyaju99
  • 465
  • 1
  • 5
  • 16
1
2 3 4 5