|
27 | 27 | import jakarta.servlet.http.HttpServletResponse; |
28 | 28 | import java.io.InputStreamReader; |
29 | 29 | import java.io.Reader; |
30 | | -import java.util.EnumSet; |
| 30 | +import java.util.Locale; |
31 | 31 | import java.util.Map; |
32 | 32 | import java.util.Set; |
33 | 33 | import org.apache.hc.core5.http.ContentType; |
@@ -57,8 +57,7 @@ public abstract class RemoteSignerServlet extends HttpServlet { |
57 | 57 | private static final String CACHE_CONTROL_PRIVATE = "private"; |
58 | 58 | private static final String CACHE_CONTROL_NO_CACHE = "no-cache"; |
59 | 59 |
|
60 | | - private static final Set<HttpMethod> CACHEABLE_METHODS = |
61 | | - EnumSet.of(HttpMethod.GET, HttpMethod.HEAD); |
| 60 | + private static final Set<String> CACHEABLE_METHODS = Set.of("GET", "HEAD"); |
62 | 61 |
|
63 | 62 | private static final Map<String, String> RESPONSE_HEADERS = |
64 | 63 | ImmutableMap.of(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType()); |
@@ -115,7 +114,7 @@ protected void validateSignRequest(RemoteSignRequest request) { |
115 | 114 | * @param response the HTTP response to add headers to |
116 | 115 | */ |
117 | 116 | protected void addSignResponseHeaders(RemoteSignRequest request, HttpServletResponse response) { |
118 | | - if (CACHEABLE_METHODS.contains(HttpMethod.valueOf(request.method()))) { |
| 117 | + if (CACHEABLE_METHODS.contains(request.method().toUpperCase(Locale.ROOT))) { |
119 | 118 | // tell the client this can be cached |
120 | 119 | response.setHeader(CACHE_CONTROL, CACHE_CONTROL_PRIVATE); |
121 | 120 | } else { |
|
0 commit comments