From 2b4da0f558aaec4f44334ea59367a95da67a53b3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 13:07:40 +0000 Subject: [PATCH 1/3] Initial plan From 15c2767bd2d860333fd521934dd7adf998f9068f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 13:11:39 +0000 Subject: [PATCH 2/3] Copy akka-http PR #4219: Add toFunctionPassThroughExceptions to RouteTest Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com> --- .../http/scaladsl/testkit/RouteTest.scala | 21 ++++++++++++++++--- .../pekko/http/scaladsl/server/Route.scala | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/http-testkit/src/main/scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala b/http-testkit/src/main/scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala index 2bbde91bd..f37d51d9d 100644 --- a/http-testkit/src/main/scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala +++ b/http-testkit/src/main/scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala @@ -20,7 +20,7 @@ import scala.reflect.ClassTag import scala.util.DynamicVariable import org.apache.pekko -import pekko.actor.ActorSystem +import pekko.actor.{ ActorSystem, ClassicActorSystemProvider } import pekko.http.scaladsl.Http import pekko.http.scaladsl.client.RequestBuilding import pekko.http.scaladsl.model._ @@ -224,8 +224,23 @@ trait RouteTest extends RequestBuilding with WSTestRequestBuilding with RouteTes } } } -private[http] object RouteTest { - def runRouteClientServer(request: HttpRequest, route: Route, serverSettings: ServerSettings)( +object RouteTest { + + /** + * Turn the route into a function for testing, but do not handle exceptions in any way, instead, they are bubbled + * out as is to the caller. + */ + def toFunctionPassThroughExceptions(route: Route)( + implicit system: ClassicActorSystemProvider): HttpRequest => Future[HttpResponse] = { + val routingLog = RoutingLog(system.classicSystem.log) + val routingSettings = RoutingSettings(system) + val parserSettings = ParserSettings.forServer + implicit val ec: ExecutionContextExecutor = system.classicSystem.dispatcher + implicit val mat: Materializer = SystemMaterializer(system).materializer + Route.createAsyncHandler(route, routingLog, routingSettings, parserSettings) + } + + private[http] def runRouteClientServer(request: HttpRequest, route: Route, serverSettings: ServerSettings)( implicit system: ActorSystem): Future[HttpResponse] = { import system.dispatcher for { diff --git a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/Route.scala b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/Route.scala index cbacfdea0..bbd20d423 100644 --- a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/Route.scala +++ b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/Route.scala @@ -85,7 +85,7 @@ object Route { SystemMaterializer(system).materializer) } - private def createAsyncHandler(sealedRoute: Route, routingLog: RoutingLog, routingSettings: RoutingSettings, + private[pekko] def createAsyncHandler(sealedRoute: Route, routingLog: RoutingLog, routingSettings: RoutingSettings, parserSettings: ParserSettings)( implicit ec: ExecutionContextExecutor, mat: Materializer): HttpRequest => Future[HttpResponse] = { request => From b54fcbfccdbcb8a238ed1c0337e670bafb6504e6 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 26 Feb 2026 13:26:50 +0100 Subject: [PATCH 3/3] Document toFunctionPassThroughExceptions with @since Add @since annotation to toFunctionPassThroughExceptions method. --- .../scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/http-testkit/src/main/scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala b/http-testkit/src/main/scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala index f37d51d9d..4ed18506c 100644 --- a/http-testkit/src/main/scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala +++ b/http-testkit/src/main/scala/org/apache/pekko/http/scaladsl/testkit/RouteTest.scala @@ -229,6 +229,7 @@ object RouteTest { /** * Turn the route into a function for testing, but do not handle exceptions in any way, instead, they are bubbled * out as is to the caller. + * @since 1.4.0 */ def toFunctionPassThroughExceptions(route: Route)( implicit system: ClassicActorSystemProvider): HttpRequest => Future[HttpResponse] = {