mergify[bot] on master
Update http4s-blaze-client, htt… Merge pull request #1443 from s… (compare)
adamw on v3.6.2
adamw on master
Release 3.6.2 (compare)
mergify[bot] on otel
adamw on master
Fix naming of OpenTelemetry bac… Fix naming of metrics & instrum… Fix naming of instrumentation s… and 8 more (compare)
adamw on master
Docs (compare)
adamw on otel
Docs (compare)
adamw on otel
Change the default OpenTelemetr… (compare)
adamw on otel
Fix docs (compare)
adamw on otel
Fix docs (compare)
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"
)
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)
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?
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?
v2
missing.
String
urls until this is fixed?
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?
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.
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?
multipartBody
, but I couldn't find a way how to set an url for each part
java.net.UnknownHostException: my.valid.host.com : nodename nor servname provided, or not known
ok I did a bit of investigation and here's where I am at the moment:
No WebSocketUpgradeHandler but scheme is ws
java.lang.IllegalArgumentException: No WebSocketUpgradeHandler but scheme is ws
at org.asynchttpclient.netty.request.NettyRequestSender.validateWebSocketRequest(NettyRequestSender.java:571)
at org.asynchttpclient.netty.request.NettyRequestSender.sendRequest(NettyRequestSender.java:95)
at org.asynchttpclient.DefaultAsyncHttpClient.execute(DefaultAsyncHttpClient.java:259)
at org.asynchttpclient.DefaultAsyncHttpClient.executeRequest(DefaultAsyncHttpClient.java:228)
at org.asynchttpclient.BoundRequestBuilder.execute(BoundRequestBuilder.java:35)
at sttp.client3.asynchttpclient.AsyncHttpClientBackend.$anonfun$sendRegular$1(AsyncHttpClientBackend.scala:59)
at sttp.client3.impl.monix.TaskMonadAsyncError$.$anonfun$async$1(TaskMonadAsyncError.scala:18)
at cancelable @ sttp.client3.impl.monix.TaskMonadAsyncError$.async(TaskMonadAsyncError.scala:17)
I get that ^^ my code is:
uri.flatMap[Vector[String]] { uri =>
AsyncHttpClientMonixBackend()
.flatMap { backend =>
basicRequest
.get(Uri(uri))
.body(msg)
.send(backend)
.flatMapLoop(Vector.empty[String]) { (each, acc: Vector[String], continue) =>
Task
.fromEither[String, String] { e: String => new Exception(e) }(each.body)
.flatMap { response =>
val newList = acc :+ response
if (terminateOn(newList))
continue(newList)
else Task.pure(newList)
}
}
.guarantee(backend.close())
}
}
uri.flatMap[Response[Either[String, Vector[String]]]] { uri =>
AsyncHttpClientMonixBackend()
.flatMap { backend =>
basicRequest
.get(Uri(uri))
.body(msg)
.response(
asWebSocket((f: WebSocket[Task]) =>
f.sendText(msg) *> f.receiveText().flatMapLoop(Vector.empty[String]) { (each, acc, continue) =>
val nAcc = acc :+ each
println(nAcc)
if (terminateOn(nAcc)) {
Task.pure(nAcc)
} else continue(nAcc)
}
)
)
.send(backend)
}
}
def uploadFile[T](
url: String,
file: File,
headers: Map[String, String],
responseMapper: String => T
): Task[T] =
for {
request <- Task.effect(
basicRequest
.body(file)
.readTimeout(2.minutes)
.put(uri"$url")
.headers(headers)
)
result <- send(request)
.provideLayer(sttpBackendLayer)
.flatMap { response =>
if (response.isSuccess)
response.body.fold(
error => Task.fail(new RuntimeException(error)),
stringRes => Task.effect(responseMapper(stringRes))
)
else Task.fail(new RuntimeException(response.statusText))
}
} yield result
Hi guys! I have a service with WebSocket stream created as
basicRequest
.get(uri)
.response(asWebSocketStream(Fs2Streams[F])(pipe))
.send(backend)
where backend is SttpBackend[F, Fs2Streams[F] with capabilities.WebSockets]
Any chance to create a stub for testing stream?
Thanks in advance