Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 27 09:52
    paulpdaniels synchronize #882
  • Feb 27 09:02
    svroonland synchronize #882
  • Feb 27 01:21
    scala-steward opened #884
  • Feb 27 01:21
    scala-steward opened #883
  • Feb 26 18:45
    svroonland edited #882
  • Feb 26 18:43
    svroonland opened #882
  • Feb 26 10:06

    mergify[bot] on simplify-sbt

    (compare)

  • Feb 26 10:06

    adamw on master

    Simplify build.sbt Simplify build.sbt Merge pull request #881 from so… (compare)

  • Feb 26 10:06
    adamw closed #881
  • Feb 26 10:05
    adamw opened #881
  • Feb 26 09:43

    adamw on simplify-sbt

    Simplify build.sbt (compare)

  • Feb 26 09:23

    adamw on simplify-sbt

    Simplify build.sbt (compare)

  • Feb 26 08:54

    adamw on master

    Update scribe to 3.4.0 Merge pull request #879 from sc… (compare)

  • Feb 26 08:54
    adamw closed #879
  • Feb 26 08:54

    adamw on master

    Update akka-http to 10.2.4 Merge pull request #878 from sc… (compare)

  • Feb 26 08:54
    adamw closed #878
  • Feb 25 15:24
    kubinio123 opened #880
  • Feb 25 15:18

    kubinio123 on 432

    - ConvertFromFuture refactor - adjusted AbstractFetchBackend… (compare)

  • Feb 25 15:15

    adamw on v3.1.6

    (compare)

  • Feb 25 15:15

    adamw on master

    Release 3.1.6 (compare)

barthorre
@barthorre
Does anyone know how to put the subprotocols for a websocket connections using HttpClientBackend?
private def apply( client: HttpClient, closeClient: Boolean, customizeRequest: HttpRequest => HttpRequest, customEncodingHandler: ZioEncodingHandler ): SttpBackend[Task, ZioStreams with WebSockets] =
in akka there seems to be an other function you can pass
private def make( actorSystem: ActorSystem, ec: ExecutionContext, terminateActorSystemOnClose: Boolean, options: SttpBackendOptions, customConnectionPoolSettings: Option[ConnectionPoolSettings], http: AkkaHttpClient, customizeRequest: HttpRequest => HttpRequest, customizeWebsocketRequest: WebSocketRequest => WebSocketRequest = identity, customEncodingHandler: EncodingHandler = PartialFunction.empty
allowing to set the subprotocol
for http client this seem to be missing
also setting the header Sec-WebSocket-Protocol results in an Illegal Header exception
Adam Warski
@adamw
I can't recall having any tests or supporting ws subprotocols, so it's possible the support is simply not there
you'd have to check if HttpClient supports this at all and then we can try to fix this in sttp
barthorre
@barthorre
  val wsBuilder = client.newWebSocketBuilder()
          client.connectTimeout().map[java.net.http.WebSocket.Builder](wsBuilder.connectTimeout(_))
          request.headers.foreach(h => wsBuilder.header(h.name, h.value))
          val cf = wsBuilder
            .buildAsync(request.uri.toJavaUri, listener)
            .thenApply[Unit](_ => ())
            .exceptionally(t => cb(Left(t)))
          Canceler(() => cf.cancel(true))
        })
1 reply
here you could do wsBuilder.subprotocols afaik
λoλcat
@catostrophe
@adamw hi. do you have any concrete plans regarding the 3.0.0 stable release date? days/weeks/months?
3 replies
Zsolt Szilagyi
@esgott
Hi all
I'm looking at the new v3 API, and there is one thing that caught my eye. In SttpBackend trait, the documentation for send states Type parameters: R – The capabilities required by the request. This must be a subset of the the capabilities supported by the backend (which always includes Effect[F])., which makes sense. However when I'm looking at AkkaHttpBackend, the type returned is SttpBackend[Future, AkkaStreams with WebSockets], so Effect[Future] is not included. Shouldn't that be there?
3 replies
Adam Warski
@adamw

Thank you for being part of the sttp community - Merry Christmas & a more regular 2021 ;)

sttp 3.0 is coming up beginning next year, along with Scala 3!

Rohan Sircar
@rohan-sircar
Merry Christmas Adam! Eager to see the release of Scala 3 and sttp 3. Also, I understand quicklens and macwire will take time since they need to be rewritten in scala3 macros, but I hope they do get ported to scala 3 in future.
2 replies
Adam Warski
@adamw
sttp client 3.0.0 got released, enjoy :) thanks for all the contributions & testing!
Philipp Dörfler
@phdoerfler
congrats! :)
Philipp Dörfler
@phdoerfler

I'm currently idiot-testing 3.0.0's akka websockets, so I created a minimal build.sbt and copy pasted this example:
https://sttp.softwaremill.com/en/latest/examples.html#open-a-websocket-using-akka

It doesn't compile! It complains:

Symbol 'type akka.event.LoggingAdapter' is missing from the classpath.
This symbol is required by 'value sttp.client3.akkahttp.AkkaHttpBackend.customLog'.
Make sure that type LoggingAdapter is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.

The akka documentation says for logging you need: "com.typesafe.akka" %% "akka-actor" % "2.6.10"
However, I saw that sttp3's akka-http-backend has this listed as provided so I went with that instead: "com.typesafe.akka" %% "akka-stream" % "2.6.10"

It compiles, but I get 0 output when I run the example. No error, no nothing.

build.sbt:

name := "meep"
scalaVersion := "2.13.4"

libraryDependencies ++= Seq(
  "com.softwaremill.sttp.client3" %% "core" % "3.0.0",
  "com.softwaremill.sttp.client3" %% "akka-http-backend" % "3.0.0",
  "com.typesafe.akka" %% "akka-stream" % "2.6.10"
)
4 replies
Philipp Dörfler
@phdoerfler

Playing this game with the monix example, I get this SSL exception when running:

runMain sttp.client3.examples.WebSocketMonix
[info] running sttp.client3.examples.WebSocketMonix
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[error] (run-main-4) sttp.client3.SttpClientException$ConnectException: Exception when sending request: GET wss://echo.websocket.org
[error] sttp.client3.SttpClientException$ConnectException: Exception when sending request: GET wss://echo.websocket.org
[error] Caused by: java.net.ConnectException: handshake timed out after 10000ms
[error] Caused by: io.netty.handler.ssl.SslHandshakeTimeoutException: handshake timed out after 10000ms

(I've omitted the stack trace elements in between due to gitter's message limits)

Philipp Dörfler
@phdoerfler
I do have an ancient Java 8 on this machine and I wouldn't be surprised if this is the cause of the SSL exception, let me upgrade it right quick
2 replies
Michal Lacko
@visox
hello, i am getting Defect in zio.Has: Set(SttpBackend[=λ %2:0 → ZIO[-Any,+Throwable,+2:0],+{ZioStreams & package::WebSockets}]) statically known to be contained within the environment are missing with latest async-http-client-backend-zio 3.0.0-RC3 any obvious ideas ?
1 reply
coreteam-co
@coreteam-co

Hi guys, I'm seeing a very strange issue when using sttp as a web socket client:

basicRequest.auth
      .basic(username, password)
      .response(asWebSocketStream(Fs2Streams[F])(webSocketFramePipe(q)))
      .get(uri)
      .send(backend)
      .void

Sometimes I'm seeing this exception when running the above code:

sttp.client3.DeserializationException: exhausted input

I'm suspecting this is an upstream server issue (it gets resolved when they restart it). On the other side using python I can connect without those issues. Anybody has seen something similar or has a hint on how to trace it down?

15 replies
Jakub Kozłowski
@kubukoz
is there an interop layer between sttp2 and 3?
1 reply
I have an sttp2 request and an sttp3 backend :sweat_smile:
Jakub Kozłowski
@kubukoz
for now I guess I'll have two backends
sebver
@sebver
hi! It seems like I'm also running into the Defect in zio.Has: Set(SttpBackend[=λ %2:0 → ZIO[-Any,+Throwable,+2:0],+{ZioStreams & package::WebSockets}]) mentioned above. I'm just not sure why, because I think I'm using the right versions (sttp = 3.0.0, zio = 1.0.3, tapir = 0.17.7). Any ideas?
2 replies
Jonas Adler
@jadlr
Hi all, I have question concerning Uri: Let's say I have a Uri from the value https://example.com/v2/ is there an easy operation to add a path without having to take care of leading and trailing slashes? something line uri.addPath("/users/hello/what")
I tried a couple of things, but I always end up with multiple slashed or the v2 missing.
Jonas Adler
@jadlr
  val uri = Uri.unsafeParse("https://api.example.com/v2/")

  println(uri.path.length) // 2
  println(uri.addPath("users", "123")) // https://api.example.com/v2//users/123
This kind of feels like a bug
1 reply
Philip Moy
@moyphilip
This message was deleted
3 replies
Philip Moy
@moyphilip
Is it possible to set pathEncoding = PathEncoding.None for the uri interpolator?
5 replies
Philip Moy
@moyphilip
Screen Shot 2021-02-01 at 9.52.15 AM.png
Jonas Adler
@jadlr
Hi, i opened an issue concerning Uri.parse here: softwaremill/sttp-model#64
Is that the correct place?
Is there a way to request String urls until this is fixed?
Jonas Adler
@jadlr
@adamw thanks a ton for the fix! Great support!
2 replies
Anirudh Vyas
@AnirudhVyas
Hi there - I am looking for some suggestions / RFCs etc to design a websocket API, I cannot find any concrete material, in REST world this is fairly well established and many good documents to follow, can someone suggest something for websocket API design? like should the focus be on resource entities and operations constraints as in rest? should it be entity_operation as a single message and that template repeated
1 reply
I know this has more to do with sttp, but I thought with so many knowledgeable people here might chance it :)
Sam Desborough
@desbo
Hi all. I've noticed that when using an http4s backend with gzip middleware enabled, requesting gzipped resources will fail with Not in gzip format. This is presumably because STTP is attempting to decompress what has already been decompressed by the http4s middleware. This suggests that backends shouldn't do their own decompression, is that true?
2 replies
Harmeet Singh(Taara)
@harmeetsingh0013
Hey All, I am using STTP client with ZIO. Currently using send method from sttp.client3.asynchttpclient.zio._ package to make the request. But when I am trying to write unit test cases for that, I found https://sttp.softwaremill.com/en/latest/testing.html send(backEnd) method with passing backend. I check, there is stubbing in sttp.client3.asynchttpclient package, but not sure, is it used for unit test our not? Another question, Do we have predefined ZIO backend or we need to define our own? for passing into the send(...) method.
5 replies
Vasyl Zhurba
@vasyl-zhurba

Hi all. I couldn't find in sttp documentation if it is possible to describe a google batch request with sttp.
https://developers.google.com/gmail/api/guides/batch#batch-example-request

POST /batch/farm/v1 HTTP/1.1
Authorization: Bearer your_auth_token
Host: www.googleapis.com
Content-Type: multipart/mixed; boundary=batch_foobarbaz
Content-Length: total_content_length

--batch_foobarbaz
Content-Type: application/http
Content-ID: <item1:12930812@barnyard.example.com>

GET /farm/v1/animals/pony

--batch_foobarbaz
Content-Type: application/http
Content-ID: <item2:12930812@barnyard.example.com>

PUT /farm/v1/animals/sheep
Content-Type: application/json
Content-Length: part_content_length
If-Match: "etag/sheep"

{
  "animalName": "sheep",
  "animalAge": "5"
  "peltColor": "green",
}

--batch_foobarbaz
Content-Type: application/http
Content-ID: <item3:12930812@barnyard.example.com>

GET /farm/v1/animals
If-None-Match: "etag/animals"

--batch_foobarbaz--

Is there a way to call google batch api with sttp client?

5 replies
From the documentation, I read that it was possible to use multipartBody, but I couldn't find a way how to set an url for each part
Harmeet Singh(Taara)
@harmeetsingh0013
I am using STTP with Cats and adding Dependencies like
```
"com.softwaremill.sttp.client3" %% "circe" % "3.1.1"
"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % "3.1.1"
Harmeet Singh(Taara)
@harmeetsingh0013
Hey all, I am creating a URL via Uri class, my test cases run, but when I used `uri"some string", my test cases failed. Even during print, I can see the same values.
1 reply
vito-c
@vito-c
is there a way to have all of my execute traffic routed through a socks5 proxy?
also I'm trying to figure out what would cause this error:
java.net.UnknownHostException: my.valid.host.com : nodename nor  servname provided, or not known
vito-c
@vito-c
I'm trying to hit the server over a proxy if that helps
vito-c
@vito-c
AsyncHttpClient/async-http-client#1682 this looks related to my issue
1 reply
Brandon G
@gannicottb
Hi, I'm using sttp3's AsyncHttpClientZioBackend. If I use the .layer methods to provide SttpClient to my effects, how am I supposed to customize the backend stub for tests? The .stubLayer method makes it impossible to add any .whenRequest-like methods to a stub (since it creates its own stub internally and maintains it via a Ref). What am I missing here?
1 reply
Brandon G
@gannicottb
IntelliJ 2020.3.1 can't figure out the return type of the whenRequest methods from sttp.client3.asynchttpclient.zio.stubbing._, and I can't even coerce with .asInstanceOf. Which means I can't chain them or even use them. Any ideas?