在 liftbook 中,有一个使用 apply 创建 Req 实例的示例:
case Req(List("api", "expense", eid), "", GetRequest) =>
() => showExpense(eid)
但是当我查看 api 文档时,有两个 apply() 方法,但我不知道本示例中是哪一个以及如何运行。
另外,有没有一种方法,如何将 /a/b
和 /a/b/c
请求包含在一个 case
中?
另外,有没有一种方法,如何枚举一个 case
中所有可能的请求:猜测:case Req(List("api", "expense", eid), "",{GetRequest,PostRequest})
?
感谢您的回答。
最佳答案
根据case
判断,这不是创建 Req
的示例,但是 pattern matching 的示例一个。
Also, is there a way, how to enumerate all possible requests in one
case
应该是
case Req(List("api", "expense", eid), "", _)
关于scala - 提升请求对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3353467/