@@ -34,6 +34,7 @@ public final class Handlers {
3434
3535 private static final Logger LOG = LoggerFactory .getLogger (Handlers .class );
3636 private static final String ALLOW = "Allow" ;
37+ private static final String GET_HEAD = "GET, HEAD" ;
3738
3839 private Handlers () {}
3940
@@ -251,7 +252,7 @@ public static RequestHandler aliveHandler() {
251252 return req ->
252253 switch (req .method ()) {
253254 case GET , HEAD -> Response .empty ();
254- default -> Response .status (HTTP_BAD_METHOD ).withHeader (ALLOW , "GET, HEAD" );
255+ default -> Response .status (HTTP_BAD_METHOD ).withHeader (ALLOW , GET_HEAD );
255256 };
256257 }
257258
@@ -276,7 +277,7 @@ public static RequestHandler healthHandler(Supplier<HealthOutcome> probe) {
276277 Objects .requireNonNull (probe , "probe" );
277278 return req -> {
278279 if (req .method () != GET && req .method () != HEAD ) {
279- return Response .status (HTTP_BAD_METHOD ).withHeader (ALLOW , "GET, HEAD" );
280+ return Response .status (HTTP_BAD_METHOD ).withHeader (ALLOW , GET_HEAD );
280281 }
281282 boolean up ;
282283 List <Dependency > dependencies ;
@@ -335,7 +336,7 @@ private static RequestHandler resourceHandler(ResourceSource source) {
335336 Response .status (HTTP_OK )
336337 .withContentType (contentType )
337338 .withHeader ("Content-Length" , String .valueOf (length ));
338- default -> Response .status (HTTP_BAD_METHOD ).withHeader (ALLOW , "GET, HEAD" );
339+ default -> Response .status (HTTP_BAD_METHOD ).withHeader (ALLOW , GET_HEAD );
339340 };
340341 }
341342}
0 commit comments