Questions tagged [sttp]

The Scala HTTP client

31 questions
1
vote
0 answers

How to ignore SSL certification on Scala using AsyncHttpClientCatsBackend?

On Scala I need a backend to send some https requests. I also have to ultimately trust my server’s certificate. When I used synchronous HttpURLConnectionBackend everything was fine because I could alter my SSLContext and replace X509TrustManager…
1
vote
1 answer

How do I make 10 http requests simultaneously?

I have 10 requests val reqTemplate = quickRequest.post(uri"http://localhost:8280/delay/1") val requests = for {i <- 1 to 10} yield { reqTemplate.body(s"{test:$i}") } How do I send these requests simultaneously? I tried val…
Gabriel
  • 1,679
  • 3
  • 16
  • 37
0
votes
1 answer

Ignore empty fields in jsonBody request and response parsing | sttp.tapir.json.circe.jsonBody

In the below example if i miss any field in the request body than it is giving the error in parsing as missing field. Can we anyway ignore it if the field is not present than it should not give error while parsing request. Also in response if the…
0
votes
2 answers

could not find implicit value for evidence parameter of type cats.MonadThrow[sttp.client3.Identity]

I'm considering using stac4s as a STAC client in our Scala project but boy, is it giving me a hard time. The use of cats, monads and all that fancy stuff is very daunting and there's no documentation to speak of. I'm stuck right at the start:…
Jan Van den bosch
  • 3,542
  • 3
  • 26
  • 38
0
votes
1 answer

Sttp, Circe, Json - how to deserialize Json to custom object?

I have a simple case class which models Http response: case class Other(name: String, age: Int) case class MyResponse(id: String, name: String, others: List[Other]) I created decoders for them: implicit val decoderOther: Decoder[Other] =…
Developus
  • 1,400
  • 2
  • 14
  • 50
0
votes
1 answer

Scala: How to do error handling on Scala STTP

I am using Scala STTP I have a call to an api that is constructed as this: val request = basicRequest .get(uri"$fullUri") .headers(headers) .response(asJson[MyClass]) Is it possible to cast errors returned to a different case class with similar…
vukojevicf
  • 609
  • 1
  • 4
  • 22
0
votes
1 answer

Can't create ArmeriaCatsBackend in IOApp with Cats effects?

I want to use ArmeriaCatsBackend as sttp backend with Cats effects. The following code does not compile: object Main extends IOApp { val backend = ArmeriaCatsBackend[IO]() // ... } could not find implicit value for evidence parameter of type…
igr
  • 10,199
  • 13
  • 65
  • 111
0
votes
1 answer

Implicitly getting Schema from class with type Alias

I'm currently using sttp version 3.3.14 with tapir version 0.18.0-M15 and I'm having trouble with the Schemas of certain case classes. More specifically, case classes that contain type aliases. Here is a simple custom Codec for Either: import…
André Machado
  • 726
  • 6
  • 21
0
votes
1 answer

Leveraging ZIO and zio-http with Sttp Client to create a client API

I'm building a library that uses Sttp.client3 as the foundation that can be implemented with Synchronous and Asynchronous environments, I'm using zio-http for my service and sttp-client to interact with other services. I have the following…
raul782
  • 479
  • 1
  • 5
  • 15
0
votes
0 answers

RocketChat: Email authentication keeps failing

We have been trying for quite a while to connect our email server to the rocketchat, but we keep getting an authorisation mistake (see log below). It might have to do with the fact that in the form one has to add user and password but it’s not very…
0
votes
0 answers

Handle Error elegantly with Scala sttp client

I'm using the scala sttp client and in particular, using the Monix backend and I have the following code: def httpTask(href: String): Task[HttpBinaryResponse] = { val request = basicRequest .get(uri"$href") AsyncHttpClientMonixBackend …
joesan
  • 13,963
  • 27
  • 95
  • 232
0
votes
1 answer

Sttp Uri Avoid Decoding

I am trying to download a file from a pre-signed s3 url: val url: String =…
collarblind
  • 4,549
  • 13
  • 31
  • 49
0
votes
2 answers

Tapir fails to decode a list of sealed trait with `DecodingFailure(CNil, List(DownArray))`

The Tapir documentation states that it supports decoding sealed traits: https://tapir.softwaremill.com/en/latest/endpoint/customtypes.html#sealed-traits-coproducts However, when I try to do so using this code, I get the following error: import…
Ruurtjan Pul
  • 1,197
  • 1
  • 10
  • 21
0
votes
1 answer

Unit test stream requests with SttpBackendStub

I have a request that returns a Source stream that I want to test, like so: /* class */ import sttp.client._ class HttpClient() (implicit sttpBackend: SttpBackend[Future, Source[ByteString, Any], Nothing]) { /** Start a download…
amdelamar
  • 346
  • 3
  • 16
0
votes
0 answers

Spark Serialization workaround for 3rd party implicit vals

I'm running a Spark job that does some Http calls along the line. I decided to use a library Sttp which requires an implicit Http backend, in my case HttpURLConnectionBackend(): an object apply which creates a new class instance, which is not…
Raf
  • 842
  • 1
  • 9
  • 25
1
2