I'm new to Finatra and scala. I need to store the ip address with another data in a post request. I'm using a custom case class:
case class MyRequest(name : String, email: String)
How can I also get remoteAddress in this request?
Thanks in advance.
I just find it in the document, you can implement your case class looks like this:
case class MyRequest (
request: Request,
name : String,
email: String
)
and the request
is the type of com.twitter.finagle.http.Request
, so you can access remoteAddress in this way:
post("/[your-api]") { r: MyRequest
val ip = r.request.remoteAddress
}