Skip to content

Commit

Permalink
Merge pull request #62 from tomjadams/master
Browse files Browse the repository at this point in the history
Expose `serviceTransform`
  • Loading branch information
jeremyrsmith authored May 10, 2017
2 parents b847210 + 22275cb commit 6ef558e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ lazy val baseSettings = docSettings ++ Seq(
"org.scalatest" %% "scalatest" % "3.0.3" % "test"
),
resolvers += Resolver.sonatypeRepo("snapshots"),
dependencyUpdatesFailBuild := true,
dependencyUpdatesFailBuild := false,
dependencyUpdatesExclusions := moduleFilter("org.scala-lang")
)

Expand Down
2 changes: 1 addition & 1 deletion featherbed-circe/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "featherbed-circe"

val circeVersion = "0.7.1"
val circeVersion = "0.8.0"

libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
Expand Down
2 changes: 1 addition & 1 deletion featherbed-core/build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name := "featherbed-core"

//featherbed-circe is duplicated in featherbed-core for testing
val circeVersion = "0.7.1"
val circeVersion = "0.8.0"

libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion % "test",
Expand Down
6 changes: 4 additions & 2 deletions featherbed-core/src/main/scala/featherbed/Client.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.nio.charset.{Charset, StandardCharsets}

import com.twitter.finagle._
import com.twitter.finagle.builder.ClientBuilder
import http.RequestBuilder
import http.{Request, RequestBuilder, Response}
import shapeless.Coproduct

/**
Expand Down Expand Up @@ -78,9 +78,11 @@ class Client(

protected def clientTransform(client: Http.Client): Http.Client = client

protected def serviceTransform(service: Service[Request, Response]): Service[Request, Response] = service

protected val client = clientTransform(Client.forUrl(baseUrl))

protected[featherbed] val httpClient = client.newService(Client.hostAndPort(baseUrl))
protected[featherbed] val httpClient = serviceTransform(client.newService(Client.hostAndPort(baseUrl)))
}

object Client {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import shapeless.{CNil, Coproduct, Witness}
* @param response The original [[Response]], so it can be further processed if desired
* @param reason A [[String]] describing why the response was invalid
*/
case class InvalidResponse(response: Response, reason: String) extends Throwable
case class ErrorResponse(request: Request, response: Response) extends Throwable
case class InvalidResponse(response: Response, reason: String) extends Throwable(reason)
case class ErrorResponse(request: Request, response: Response) extends Throwable("Error response received")

trait RequestTypes { self: Client =>

Expand Down

0 comments on commit 6ef558e

Please sign in to comment.