Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/scala/com/cognite/sdk/scala/v1/Client.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ final case class RequestSession[F[_]: Trace](
auth: AuthProvider[F],
clientTag: Option[String] = None,
cdfVersion: Option[String] = None,
tags: Map[String, Any] = Map.empty
tags: Map[String, Any] = Map.empty,
wrapSttpBackend: SttpBackend[F, _] => SttpBackend[F, _] = identity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The addition of wrapSttpBackend to RequestSession is a good approach to allow for more flexible client customization. However, this new functionality is not currently exposed to the end-user.

The GenericClient is responsible for creating the RequestSession, but it has not been updated to accept or pass along the wrapSttpBackend function. As a result, the RequestSession will always be created with the default identity wrapper, and the new feature will be unusable.

To complete this feature, you'll need to thread the wrapSttpBackend parameter through GenericClient's constructors and factory methods, and use it when instantiating RequestSession.

)(implicit F: CMonadError[F, Throwable]) {
val implicits: RequestSessionImplicits[F] = new RequestSessionImplicits[F]
def withResourceType(resourceType: GenericClient.RESOURCE_TYPE): RequestSession[F] =
this.copy(tags = this.tags + (GenericClient.RESOURCE_TYPE_TAG -> resourceType))

val sttpBackend: SttpBackend[F, _] =
new AuthSttpBackend(new TraceSttpBackend(baseSttpBackend), auth)
wrapSttpBackend(new AuthSttpBackend(new TraceSttpBackend(baseSttpBackend), auth))

def send[R](
r: RequestT[Empty, Either[String, String], Any] => RequestT[Id, R, Any]
Expand Down
Loading