Skip to content

Commit

Permalink
Merge pull request #134 from hmrc/http-verb-test-fix
Browse files Browse the repository at this point in the history
BAU Fix resource leak in tests
  • Loading branch information
colin-lamed authored Oct 11, 2021
2 parents 52e6ece + 3700daa commit 0dbee4e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ import play.api.libs.ws.WSClient
import uk.gov.hmrc.http._
import uk.gov.hmrc.http.hooks.HttpHook
import uk.gov.hmrc.play.http.ws.WSHttp
import play.api.libs.ws.ahc.{AhcWSClientConfig, AhcWSClientConfigFactory}
import play.api.libs.ws.ahc.{AhcWSClient, AhcWSClientConfigFactory}

trait HttpClientSupport {
def mkHttpClient(config: Config = ConfigFactory.load(), ahcWsCconfig: AhcWSClientConfig = AhcWSClientConfig()) =
def mkHttpClient(
config: Config = ConfigFactory.load()
) =
new HttpClient with WSHttp {
private implicit val as: ActorSystem = ActorSystem("test-actor-system")

@silent("deprecated")
private implicit val mat: Materializer = ActorMaterializer() // explicitly required for play-26

override def wsClient: WSClient = play.api.libs.ws.ahc.AhcWSClient(AhcWSClientConfigFactory.forConfig(config))
override protected def configuration: Config = config
override val wsClient: WSClient = AhcWSClient(AhcWSClientConfigFactory.forConfig(config))
override protected val configuration: Config = config
override val hooks: Seq[HttpHook] = Seq.empty
override protected def actorSystem: ActorSystem = as
}
Expand Down

0 comments on commit 0dbee4e

Please sign in to comment.