From 67d13a4b20a8ab3f02b3f01fc7ef23867c1e04d7 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 31 May 2023 04:10:38 +0100 Subject: [PATCH] Allows all methods in CORS. See https://github.com/TeamPiped/Piped/pull/2471 --- .../me/kavin/piped/utils/CustomServletDecorator.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/kavin/piped/utils/CustomServletDecorator.java b/src/main/java/me/kavin/piped/utils/CustomServletDecorator.java index 53b6ee5..988b5d9 100644 --- a/src/main/java/me/kavin/piped/utils/CustomServletDecorator.java +++ b/src/main/java/me/kavin/piped/utils/CustomServletDecorator.java @@ -4,8 +4,7 @@ import io.activej.http.*; import io.activej.promise.Promisable; import org.jetbrains.annotations.NotNull; -import static io.activej.http.HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS; -import static io.activej.http.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN; +import static io.activej.http.HttpHeaders.*; public class CustomServletDecorator implements AsyncServlet { @@ -24,8 +23,10 @@ public class CustomServletDecorator implements AsyncServlet { HttpHeaderValue headerValue = HttpHeaderValue.of("app;dur=" + (System.nanoTime() - before) / 1000000.0); - return response.withHeader(HEADER, headerValue).withHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*") - .withHeader(ACCESS_CONTROL_ALLOW_HEADERS, "*, Authorization"); + return response.withHeader(HEADER, headerValue) + .withHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*") + .withHeader(ACCESS_CONTROL_ALLOW_HEADERS, "*, Authorization") + .withHeader(ACCESS_CONTROL_ALLOW_METHODS, "*"); }); }