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:
parent
1e79bd18a7
commit
961bf3c1dd
1 changed files with 119 additions and 132 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Reference in a new issue