Browse Source

Add simple healthcheck handler

tags/v1.6.0
parent
commit
4710093600
2 changed files with 7 additions and 0 deletions
  1. +1
    -0
      src/main/java/org/perfectable/repositable/Server.java
  2. +6
    -0
      src/test/java/org/perfectable/repositable/EmptyTest.java

+ 1
- 0
src/main/java/org/perfectable/repositable/Server.java View File

@@ -71,6 +71,7 @@ public final class Server {
ArtifactHandler.of(repositorySelector, PackageLocation::fromPath))
.withHandler(SnapshotLocation.PATH_PATTERN,
ArtifactHandler.of(repositorySelector, SnapshotLocation::fromPath))
.withHandler("/health", RequestHandler.constant(HttpResponse.OK))
.withRootHandler(RequestHandler.constant(HttpResponse.NOT_FOUND));
}



+ 6
- 0
src/test/java/org/perfectable/repositable/EmptyTest.java View File

@@ -22,6 +22,12 @@ public class EmptyTest extends AbstractServerTest {
.isNotFound();
}

@Test
public void testHealthcheck() {
assertConnectionTo(createUrl("/health"))
.returnedStatus(200);
}

@Test
public void testArbitraryPath() {
assertConnectionTo(createUrl("/test/arbitrary/path"))


Loading…
Cancel
Save