mergify[bot] on master
Update scalafmt-core to 3.5.3 Merge pull request #1440 from s… (compare)
mergify[bot] on master
Update zio-interop-reactivestre… Merge pull request #1439 from s… (compare)
PlainCodec[Option[Filter]]
you might override the built-in mechanism for handling optionals. As I assume there exists a PlainCodec[Option[A]]
for any A
where PlainCodec[A]
exists. Which means you should define a PlainCodec[Filter]
and then it plays nicely.
PlainCodec[Option[Filter]]
defined a codec between String <-> Option[Filter]
. However, query
requires a codec between List[String] <-> Option[Filter]
- as query parameters can be repeated. Tapir knows how to convert a String <-> T
codec into List[String] <-> Option[T]
, but doesn't have built in conversions for String <-> Option[T]
Hey team, sttp 3.3.15 introduced a binary incompatibility with 3.3.14, is that a known issue? Particularly it was this change:
https://github.com/softwaremill/sttp/pull/1119/files#diff-328a76b199b03a413e3a607009ce6d0ee31047193247381451e5b1362c1c96eeR15
I spotted this because my application gave me a "Exception in thread "main" java.lang.NoSuchMethodError: sttp.client3.FollowRedirectsBackend.<init>(Lsttp/client3/SttpBackend;Lscala/collection/immutable/Set;Lscala/collection/immutable/Set;)V"
(That happened after I updated one of my dependencies which transitively pulled 3.3.16 and my current version of sttp which was 3.3.14 was evicted)
Hi there. I'm having a hard time upgrading from v2 to v3 due to the requirement of send
to tie R
to an Effect[F]
I had a class with the following definition:
class TracedLoggingSttpBackend[F[_], G[_]: Sync: Trace, +P](
val delegate: SttpBackend[F, P],
liftK: F ~> G
) extends SttpBackend[G, P]
And I was able to pass the Request
from the backend to its delegate and simply run liftK
on the result of it.
Now, because Request
is tied to the SttpBackend's first type param (F or G), the requests become incompatible.
This was the setup we were using to tie in Natchez's kleisli usage through Sttp's backends.
From what I can see, I need to be able to convert between the two, like so:
def convertRequest[T, RF >: P with Effect[F], RG >: P with Effect[G]](
request: Request[T, RG]
): Request[T, RF]
But I have no idea how I could accomplish that
Hi there, I'm running into issues using AsyncHttpClientZioBackend. I'm initiating it like that:
lazy val httpClientLayer: ULayer[Has[SttpBackend[Task, ZioStreams with capabilities.WebSockets]]] = {
ZLayer.fromAcquireRelease(AsyncHttpClientZioBackend())(_.close().ignore).orDie
}
and giving it to my class using Zlayer. Unfortunately, I have requests that send me the error: IllegalStateException: Closed
. I'm wondering if anyone had issues with this before. Thanks a lot in advance
I have a strange low level exception ('IndexOutOfBoundsException') in 'backend.send(req)' which appears only on 1 out of ~100 endpoints . I'm clutching at straws with this bug and the my hipotesis is that moving from sttp 3.3.4 to 3.3.18 and upgrade of scalajs-dom to 2.0.0 is the differential "cause".
I'm using FetchMonixBackend and I see in the source code that it still uses 'import org.scalajs.dom.experimental...' which is no longer available in scalajs-dom 2.0.0
Is sttp compatible with scalajs-dom 2.0.0 ?
Any clues what can I check more ?
AkkaHttpBackend.usingActorSystem(actorSystem)
, actorSystem must be a classic actor system, not a typed one. Any hints how I can take my existing typed actor system and use it in AkkaHttpBackend.usingActorSystem
?
I think there is an issue with release 3.4.1 of sttp for zio1.
https://github.com/softwaremill/sttp/blob/v3.4.1/build.sbt#L845 is using zio-json 0.3 which is targeting ZIO2
It should have been 0.2.0-M3 which is the latest release of zio-json for zio 1.
I've opened a PR https://github.com/softwaremill/sttp/pull/1318/files if anyone can have a looks that would be great. Thanks
MaskedBodySerializer
and use it in our wrapper backend. But when request reaches backend, its body already serialized to String. One way I see is to use tag for passing masked serialized body. Is there better approach?
HttpClientZioBackend
and calling vk.com API..
in the name, for example https://api.vk.com/method/photos.getAll
(query params omitted).show
and open it in browser or print curl with .toCurl
and run it in console or use synchronous HttpURLConnectionBackend
or AsyncHttpClientZioBackend
I get a successful response.AsyncHttpClientZioBackend
as a workaround, but wanted to use client with no extra dependencies, maybe someone knows how to overcome this problem.
Hello, I am attempting to send requests via sttp3, however I am getting the following error: Cannot prove that Any with sttp.capabilities.Effect[[X]sttp.client3.Identity[X]] <:< Nothing.
I am sending the request as follows:
val api = DefaultApi.apply()
val backend = HttpURLConnectionBackend()
println(api.addProduct("Calculator").send(backend))
where:
def addProduct(productName: String
): Request[Either[ResponseException[String, Exception], String], Nothing] =
basicRequest
.method(Method.POST, uri"$baseUrl/products/${productName}")
.contentType("application/json")
.response(asJson[String])
Am I doing something wrong? Thanks!
Any
and not Nothing
, otherwise the compiler will not be able to derive the correct effect (as Nothing is the bottom type) * @tparam R
* The backend capabilities required by the request or response description. This might be `Any` (no requirements),
* [[Effect]] (the backend must support the given effect type), [[Streams]] (the ability to send and receive
* streaming bodies) or [[sttp.capabilities.WebSockets]] (the ability to handle websocket requests).
Hello everyone. The following code is generated using the openapi-generator:
def addRequiresConstraintToProduct(productName: String, sourceFeature: String, requiredFeature: String
): Request[Either[Either[String, String], Unit], Any] =
basicRequest
.method(Method.POST, uri"$baseUrl/products/${productName}/constraints/requires")
.contentType("multipart/form-data")
.multipartBody(Seq(
multipart("sourceFeature", sourceFeature)
,
multipart("requiredFeature", requiredFeature)
).flatten)
.response(asEither(asString, ignore))
And it is giving the following error:
No implicit view available from sttp.model.Part[sttp.client3.BasicRequestBody] => scala.collection.IterableOnce[B]
).flatten)
^
Any help would be greatly appreciated. Thanks!
com.ocadotechnology.sttp.oauth2.common$OAuth2Exception: Client call resulted in error (200): expected json value got 'grant_...
val accessTokenProvider: AccessTokenProvider[Task] =
AccessTokenProvider[Task](uri"${tokenUrl}", NonEmptyString.unsafeFrom(clientId), Secret(secret))(sttpBackend)
(for {
token: ClientCredentialsToken.AccessTokenResponse <- accessTokenProvider.requestToken(scope)
} yield token.accessToken.value)
RequestT#logSettings
that adds the tag. I expected that the logging backend wrapper would set this tag on every send, but I see no callers of this. What am I missing?
Hello! I'm trying to upgrade some code from com.softwaremill.sttp. to sttp.client3., and looking for a way to deal with unsafeBody alternative.
for example,
url = "bad url" token = "bad token"
in softwaremill I did this:
response = Try(sttp.auth.bearer(token).get(uri"$urlStr").send.unsafeBody)
In this case response.isFailure = true
but sttp.client3 doesn't have this method:
response = basicRequest.auth.bearer(token).get(uri"$urlStr").send(backend).body
response match {
case Right(resp) => Try(resp)
case Left(error) =>
logger.error(s"API call failed: $error")
Try(error)
}
But in this case response would give an exception, which I don't need.
Does anyone have some thoughts to do this?