-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from buildo/api-135-add_prefix_to_client
- Loading branch information
Showing
3 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
package wiro | ||
|
||
import akka.http.scaladsl.model.HttpRequest | ||
import akka.http.scaladsl.server.Route | ||
import akka.http.scaladsl.testkit.{ RouteTest, TestFrameworkInterface } | ||
import akka.http.scaladsl.server._ | ||
import akka.http.scaladsl.server.Directives._ | ||
import akka.http.scaladsl.testkit._ | ||
|
||
import cats.implicits._ | ||
import client.akkaHttp.{ RPCClient, RPCClientContext } | ||
|
||
import scala.concurrent.Future | ||
|
||
trait RPCRouteTest extends RouteTest { this: TestFrameworkInterface => | ||
val prefix = Some("test") | ||
class RPCClientTest(ctx: RPCClientContext[_], route: Route) | ||
extends RPCClient(config = Config("localhost", 80), ctx = ctx){ | ||
extends RPCClient(config = Config("localhost", 80), prefix = prefix, ctx = ctx){ | ||
override private[wiro] def doHttpRequest(request: HttpRequest) = | ||
(request ~> route).response.pure[Future] | ||
(request ~> pathPrefix(prefix.get)(route)).response.pure[Future] | ||
} | ||
} |