更新时间:2022-12-01 20:51:35
使用*path
段执行某项操作-即使不执行任何操作...
Do something with *path
segment - even if nothing...
路线:
OPTIONS / controllers.Application.options(path: String ?= "")
OPTIONS /*path controllers.Application.options(path)
操作:
def options(path: String) = Action {
Ok("").withHeaders(
"Access-Control-Allow-Origin" -> "*",
"Access-Control-Allow-Methods" -> "GET, POST, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers" -> "Accept, Origin, Content-type, X-Json, X-Prototype-Version, X-Requested-With",
"Access-Control-Allow-Credentials" -> "true",
"Access-Control-Max-Age" -> (60 * 60 * 24).toString
)
}
有效