Reputation: 1730
I need to log the raw request whenever I receive a particular post "Event" using Finch's post()
.
I have something like that:
val myEvent: Endpoint[String] = post("somepath" :: ipRangeEndpoint :: path[Long] :: jsonBody[Event]) {
(matchId: Long, event: Event) =>
(event match {
case _: Event.ToBeLogged =>
logger.debug(<REQUESTHERE>)
Ok("logged")
})
}
so let's say that, for a subset of cases, I need to log an incoming com.twitter.finagle.http.Request
. How can I do that?
Upvotes: 1
Views: 168
Reputation: 2004
https://finagle.github.io/finch/user-guide.html#root-request
"It’s possible that Finch might be missing some of handy endpoints out of the box, especially that it’s evolved separately from Finagle. To overcome this and provide an extension point, there is a special endpoint instance, called root that returns a raw Finagle Request."
Upvotes: 1