Binary Lion Studios

I code for fun and for food.

Lift RestHelper format

To require a certain suffix in a REST request using Lift, you can use the unapply method on the Req object.

1
2
3
4
serve("api" / "users" prefix {
  case AsLong(id) :: "posts" :: _ Get Req(_, "xls", _) =>
    // do your thing. 
})

This would match /api/users/1/posts.xls.