1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-24 14:50:46 +01:00

Remove custom rejections

This commit is contained in:
Andrea 2019-03-15 18:23:09 +01:00
parent 1e79bd18a7
commit 961bf3c1dd
No known key found for this signature in database
GPG key ID: FFB3470FFF04CA76

View file

@ -46,13 +46,6 @@ trait NewService extends Directives with Logging with MetaService {
complete(StatusCodes.InternalServerError, s"Error: $t")
}
val apiRejectionHandler = RejectionHandler.newBuilder()
.handle {
case UnknownMethodRejection => complete(StatusCodes.BadRequest, "Wrong method or params combination")
case UnknownParamsRejection => complete(StatusCodes.BadRequest, "Wrong params combination")
}
.result()
val customHeaders = `Access-Control-Allow-Headers`("Content-Type, Authorization") ::
`Access-Control-Allow-Methods`(POST) ::
`Cache-Control`(public, `no-store`, `max-age`(0)) :: Nil
@ -86,14 +79,9 @@ trait NewService extends Directives with Logging with MetaService {
case _ => akka.pattern.after(1 second, using = actorSystem.scheduler)(Future.successful(None)) // force a 1 sec pause to deter brute force
}
case object UnknownMethodRejection extends Rejection
case object UnknownParamsRejection extends Rejection
val route: Route = {
respondWithDefaultHeaders(customHeaders) {
handleExceptions(apiExceptionHandler) {
handleRejections(apiRejectionHandler) {
withRequestTimeoutResponse(timeoutResponse) {
authenticateBasicAsync(realm = "Access restricted", userPassAuthenticator) { _ =>
post {
@ -223,7 +211,6 @@ trait NewService extends Directives with Logging with MetaService {
}
}
}
}
val help = List(
"connect (uri): open a secure connection to a lightning node",