From e18571778aceea9697684a2f78641cd84288aba1 Mon Sep 17 00:00:00 2001 From: dalbodeule <11470513+dalbodeule@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:29:59 +0900 Subject: [PATCH] add Session flows - fix CORS --- .../src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt index 155e6e0..ab3e1b2 100644 --- a/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt +++ b/webserver/src/main/kotlin/space/mori/chzzk_bot/webserver/Main.kt @@ -20,7 +20,6 @@ import io.ktor.server.sessions.* import io.ktor.server.websocket.* import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json -import space.mori.chzzk_bot.common.dotenv import space.mori.chzzk_bot.webserver.routes.* import java.time.Duration @@ -48,8 +47,12 @@ val server = embeddedServer(Netty, port = 8080, ) { }) } install(CORS) { + allowMethod(HttpMethod.Options) + allowMethod(HttpMethod.Put) + allowMethod(HttpMethod.Patch) + allowMethod(HttpMethod.Delete) + allowMethod(HttpMethod.Get) anyHost() - allowHeader(HttpHeaders.ContentType) } install(Sessions) { cookie("user_session", storage = SessionStorageMemory()) {}