lila/app/controllers/Options.scala

19 lines
409 B
Scala
Raw Normal View History

2019-09-20 09:57:26 -06:00
package controllers
import lila.app._
2019-09-21 10:04:16 -06:00
import lila.common.HTTPRequest.isApiOrApp
2019-12-06 09:39:42 -07:00
import lila.app.http.ResponseHeaders.allowMethods
2019-09-20 09:57:26 -06:00
2019-12-04 16:39:16 -07:00
final class Options(env: Env) extends LilaController(env) {
2019-09-20 09:57:26 -06:00
val root = all("")
def all(url: String) = Action { req =>
2019-09-21 10:04:16 -06:00
if (isApiOrApp(req)) NoContent.withHeaders(
2019-09-20 15:22:53 -06:00
"Allow" -> allowMethods,
"Access-Control-Max-Age" -> "1728000"
)
else NotFound
2019-09-20 09:57:26 -06:00
}
}