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

Spray JSON - parse only part of the JSON response

I have the following Json response from the server where samples object contains { "op":{ "samples":{ "name1" :[0,0,0,0,0,0,0], "name2" :[0,0,0,0,0,0,0], "name3" :[0,0,0,0,0,0,0], //About 100…
danny.lesnik
  • 18,479
  • 29
  • 135
  • 200
1
vote
1 answer

found : spray.routing.Directive0 (which expands to) spray.routing.Directive[shapeless.HNil] required: spray.routing.Directive[shapeless.HList]

I need help. I am trying to use CURL to do HTTP POST & use spray routing along with parameters curl -v -o UAT.json "http://*****/pvdtest1/14-JUL-2014?enriched=true" -H "Content-Type: application/json" -d '{ "text": "Test", "username": "User" }' My…
Kunal
  • 11
  • 1
1
vote
1 answer

Accessing spray request from spray response

I'm calling this function every 50 ms : def send() = { val myData = generateRandomData() val response = pipeline(Post("http://slow-website.com/send", myData)) response onComplete { case Success(r) => ? how to access myData ? …
Martin Magakian
  • 3,746
  • 5
  • 37
  • 53
1
vote
1 answer

Spray Unzip HttpResponse

I'm using Spray API(spray-client) to hit an external URL and I'm getting gzipped HttpResponse. How do I unzip this HttpResponse to get its entity(json, in my case)? val future: Future[HttpResponse] = (IO(Http) ? Get(uri)).mapTo[HttpResponse] val…
turiLauke
  • 11
  • 1
1
vote
1 answer

Using spray client to make REST web service calls inside an Actor system

I've an Actor system that is processing a continuous stream messages from an external system. I've the following actors in my system. SubscribeActor - this actor subscribes to a Redis channel and creates a new InferActor and passes the JSON…
Soumya Simanta
  • 11,523
  • 24
  • 106
  • 161
1
vote
1 answer

Generic Spray-Client

I'm trying to create a generic HTTP client in Scala using spray. Here is the class definition: object HttpClient extends HttpClient class HttpClient { implicit val system = ActorSystem("api-spray-client") import system.dispatcher val log =…
atom.gregg
  • 987
  • 8
  • 14
1
vote
0 answers

Optimizing a humbly large node.js response

I am responding with a large (10 MB) payload from node.js to an Akka spray.io based actor, and getting a chunk size error from spray/akka [akka://spray-actor-system/user/IO-HTTP/group-0/3] Received illegal response: HTTP chunk size exceeds the…
matanster
  • 15,072
  • 19
  • 88
  • 167
1
vote
0 answers

spray client sometimes throws Corrupt data (CRC32 checksum error)

I wrote my client code as val pipeGzipGet: HttpRequest => Future[String] = ( addHeader("Accept-Encoding", "gzip ") ~> sendReceive ~> logByteArray ~> decode(Gzip) ~> unmarashal[String] ) It works fine most times , but…
jilen
  • 5,633
  • 3
  • 35
  • 84
0
votes
1 answer

How to call rest API from another server scala

I am new in scala. Currently, to create rest API I'm using the spray. Now I want to consume API from another server. I'm calling this API on every key-stroke from UI. I'm aborting the request using AbortController if the user keeps typing and the…
dharmesh singh
  • 101
  • 1
  • 6
0
votes
1 answer

Spray client Request timeout

I am new to scala. I am trying to timeout api request. I am using spray to make API request. I have spray client to get response from some other server. In my application.conf i've specified timeout of request in spray.can something like: spray.can…
dharmesh singh
  • 101
  • 1
  • 6
0
votes
1 answer

Abort spray request when aborted from reactjs

I am new to scala and spray. I am able to abort request from reactJS. And it shows in network tab of browser console that the request is cancelled. But from scala it is not aborting. In logs i can see api is getting hitted. For Rest API I am using…
dharmesh singh
  • 101
  • 1
  • 6
0
votes
1 answer

Spray Http Post request

Here is the code which I am trying to create a Post request through the spray http package org.exadatum.xstream.service.http import akka.actor.ActorSystem import akka.util.Timeout import spray.http._ import spray.httpx.SprayJsonSupport import…
Vishal
  • 1,442
  • 3
  • 29
  • 48
0
votes
2 answers

Why is my map() not working?

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 am trying to…
codingsplash
  • 4,785
  • 12
  • 51
  • 90
0
votes
1 answer

How can I tell a specific spray-client request to follow all redirects?

I have a specific pipeline in my app that must follow all redirects (let's say up to 50 for sanity's sake), across any domain and protocol (e.g. it could follow http://somewhere.com to https://somewhere.else.com), but only for GET requests. No other…
Omer van Kloeten
  • 11,800
  • 9
  • 42
  • 53
0
votes
1 answer

Getting "dead letters encountered" using spray client

I'm writing simple spray client code: // ActorSystem("main-actor-system") initialized earlier in code implicit val system = actorSystem implicit val execctx: scala.concurrent.ExecutionContext = system.dispatcher implicit val timeout =…
Julias
  • 5,752
  • 17
  • 59
  • 84