forked from Cookies_Github_mirror/AquaDX
[F] Wacca: Fix handle
This commit is contained in:
@@ -60,7 +60,8 @@ class WaccaServer(val rp: WaccaRepos, val cardRepo: CardRepository) {
|
||||
|
||||
/** Handle all requests */
|
||||
@API("/api/**")
|
||||
fun handle(req: HttpServletRequest, @RB body: String) = try {
|
||||
fun handle(req: HttpServletRequest, @RB body: String): Any {
|
||||
return try {
|
||||
val path = req.requestURI.removePrefix("/g/wacca").removePrefix("/api").removePrefix("/").lowercase()
|
||||
if (path in cacheMap) return resp(cacheMap[path]!!)
|
||||
if (path !in handlerMap) return resp("[]", 1, "Not Found")
|
||||
@@ -79,6 +80,7 @@ class WaccaServer(val rp: WaccaRepos, val cardRepo: CardRepository) {
|
||||
log.error("Wacca > Error", e)
|
||||
resp("[]", 500, e.message ?: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
|
||||
Reference in New Issue
Block a user