Reputation: 323
I have a play application where I would like to accept custom headers in controller actions. How does one look up a custom header element in a controller method(action)? I'm coming from ruby rails/sinatra
Upvotes: 0
Views: 38
Reputation: 7466
When you write an action like:
val echo = Action { request =>
Ok("Got request [" + request + "]")
}
request
is of type Request
and has a field headers: Headers
which works pretty much like a Map
. You can access all the headers that were sent with this object.
Upvotes: 2