Skip to content

Commit

Permalink
Add detailed comments for custom HttpClient setups
Browse files Browse the repository at this point in the history
Clarify the purpose of HttpClient configurations in `SttpRestCallTest` and `JettyRestCallTest`. The added comments explain the use of a connection timeout significantly exceeding the CallTimeout value, improving code readability and maintainability.
  • Loading branch information
halotukozak committed Dec 23, 2024
1 parent 01cf9f0 commit c149256
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import scala.concurrent.duration.*
import scala.concurrent.{Await, Future}

trait SttpClientRestTest extends ServletBasedRestApiTest {
/**
* Similar to the defaultHttpClient, but with a connection timeout
* significantly exceeding the value of the CallTimeout
*/
implicit val backend: SttpBackend[Future, Any] = HttpClientFutureBackend.usingClient(
//like defaultHttpClient but with connection timeout >> CallTimeout
HttpClient
.newBuilder()
.connectTimeout(JDuration.ofMillis(IdleTimout.toMillis))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import io.udash.rest.{RestApiTestScenarios, ServletBasedRestApiTest}
import org.eclipse.jetty.client.HttpClient

final class JettyRestCallTest extends ServletBasedRestApiTest with RestApiTestScenarios {
/**
* Similar to the default HttpClient, but with a connection timeout
* significantly exceeding the value of the CallTimeout
*/
val client: HttpClient = new HttpClient() {
setMaxConnectionsPerDestination(MaxConnections)
setIdleTimeout(IdleTimout.toMillis)
Expand Down

0 comments on commit c149256

Please sign in to comment.