【发布时间】:2017-10-25 21:02:42
【问题描述】:
我的路由中定义了查询参数,如下所示:
parameters(('modifiedDate.as[String].?, 'active.as[Boolean].?)) { (modifiedDate, active) =>
我有以下拒绝处理程序:
RejectionHandler.newBuilder()
.handle { case MalformedQueryParamRejection(param, _, _) =>
param match {
case "modifiedDate" => ...
case "active" => ...
}
}
问题是 MalformedQueryParamRejection 只匹配第一个错误,所以如果两个查询参数都通过并且都不正确:
some-endpoint?modifiedDate=invalid&active=invalid
客户端只会被告知第一个错误。
有没有什么方法可以使用 akka http 来获知所有无效的查询参数,例如 MalformedQueryParamRejection 但会报告所有无效的查询参数,例如 MalformedQueryParamsRejection(复数)?
【问题讨论】: