Skip to content

Commit

Permalink
Bumped http4s and cats
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakky54 committed May 22, 2024
1 parent 6edf798 commit dbc06a9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ import cats.effect.{ExitCode, IO, IOApp, Resource}
import nl.altindag.client.ClientType
import nl.altindag.client.ClientType.HTTP4S_BLAZE_CLIENT
import nl.altindag.ssl.SSLFactory
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.client.Client
import org.http4s.client.blaze.BlazeClientBuilder
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.context.annotation.Bean
import org.springframework.stereotype.{Component, Service}

import scala.concurrent.ExecutionContext.Implicits.global

@Service
class Http4sBlazeClientService(@Qualifier("blazeClient") client: Resource[IO, Client[IO]]) extends Http4sService(client) {

Expand All @@ -39,7 +37,7 @@ class BlazeClientConfiguration extends IOApp {

@Bean(name = Array("blazeClient"))
def createBlazeClient(sslFactory: SSLFactory): Resource[IO, Client[IO]] = {
BlazeClientBuilder[IO](global)
BlazeClientBuilder[IO]
.withSslContext(sslFactory.getSslContext)
.resource
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package nl.altindag.client.service

import cats.effect.{Blocker, ExitCode, IO, IOApp, Resource}
import cats.effect.{ExitCode, IO, IOApp, Resource}
import nl.altindag.client.ClientType
import nl.altindag.client.ClientType.HTTP4S_JAVA_NET_CLIENT
import nl.altindag.ssl.SSLFactory
Expand All @@ -24,8 +24,6 @@ import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.context.annotation.Bean
import org.springframework.stereotype.{Component, Service}

import scala.concurrent.ExecutionContext.Implicits.global

@Service
class Http4sJavaNetClientService(@Qualifier("javaNetClient") client: Resource[IO, Client[IO]]) extends Http4sService(client) {

Expand All @@ -38,7 +36,7 @@ class JavaNetClientConfiguration extends IOApp {

@Bean(name = Array("javaNetClient"))
def createJavaNetClient(sslFactory: SSLFactory): Resource[IO, Client[IO]] = {
JavaNetClientBuilder[IO](Blocker.liftExecutionContext(global))
JavaNetClientBuilder[IO]
.withSslSocketFactory(sslFactory.getSslSocketFactory)
.withHostnameVerifier(sslFactory.getHostnameVerifier)
.resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package nl.altindag.client.service

import cats.effect.unsafe.implicits.global
import cats.effect.{IO, Resource}
import nl.altindag.client.Constants.HEADER_KEY_CLIENT_TYPE
import nl.altindag.client.model.ClientResponse
Expand All @@ -32,7 +33,7 @@ abstract class Http4sService(client: Resource[IO, Client[IO]]) extends RequestSe

val responseBody = client
.use(client => client.expect[String](request))
.unsafeRunSync()
.unsafeRunSync

// the client will throw a runtime exception for any other status code than 2xx
// therefore it won't even reach to this point if it gets a non 2xx status code.
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<version.sttp>4.0.0-M14</version.sttp>
<version.requests>0.8.2</version.requests>
<version.kohttp>0.12.0</version.kohttp>
<version.http4s>1.0-234-d1a2b53</version.http4s>
<version.http4s>0.23.16</version.http4s>
<version.feign>11.8</version.feign>
<version.methanol>1.6.0</version.methanol>
<version.ktor>2.3.11</version.ktor>
Expand All @@ -63,7 +63,7 @@
<version.jax-rs-v2>2.1.1</version.jax-rs-v2>
<version.netty-handler>4.1.99.Final</version.netty-handler>
<version.netty-tcnative>2.0.62.Final</version.netty-tcnative>
<version.cats>2.7.0</version.cats>
<version.cats>2.10.0</version.cats>
<version.awaitility>4.1.1</version.awaitility>
<version.jackson-module-scala>2.13.1</version.jackson-module-scala>
<version.jacoco-maven-plugin>0.8.7</version.jacoco-maven-plugin>
Expand Down

0 comments on commit dbc06a9

Please sign in to comment.