Skip to content

Commit

Permalink
added host header to http requests
Browse files Browse the repository at this point in the history
  • Loading branch information
puneetkhanduri committed Nov 1, 2019
1 parent 2554d51 commit bc24628
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/scala/ai/diffy/proxy/HttpDifferenceProxy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ object HttpDifferenceProxy {
}
}
}

def requestHostHeaderFilter(host: String) =
Filter.mk[Request, Response, Request, Response] { (req, svc) =>
req.host(host)
svc(req)
}
}

trait HttpDifferenceProxy extends DifferenceProxy {
import HttpDifferenceProxy._
val servicePort: SocketAddress
val lifter = new HttpLifter(settings.excludeHttpHeadersComparison, settings.resourceMatcher)

Expand All @@ -34,7 +41,7 @@ trait HttpDifferenceProxy extends DifferenceProxy {
override type Srv = HttpService

override def serviceFactory(serverset: String, label: String) =
HttpService(Http.newClient(serverset, label).toService)
HttpService(requestHostHeaderFilter(serverset) andThen Http.newClient(serverset, label).toService)

override lazy val server =
Http.serve(
Expand Down

0 comments on commit bc24628

Please sign in to comment.