@Override public Route trace() { return route().method(HttpMethod.TRACE); }
@Override public Route patch() { return route().method(HttpMethod.PATCH); }
@Override public Route head() { return route().method(HttpMethod.HEAD); }
@Override public Route options() { return route().method(HttpMethod.OPTIONS); }
@Override public Route post() { return route().method(HttpMethod.POST); }
@Override public Route delete() { return route().method(HttpMethod.DELETE); }
@Override public Route put() { return route().method(HttpMethod.PUT); }
@Override public Route getWithRegex(String path) { return route().method(HttpMethod.GET).pathRegex(path); }
@Override public Route traceWithRegex(String path) { return route().method(HttpMethod.TRACE).pathRegex(path); }
@Override public Route optionsWithRegex(String path) { return route().method(HttpMethod.OPTIONS).pathRegex(path); }
@Override public Route postWithRegex(String path) { return route().method(HttpMethod.POST).pathRegex(path); }
@Override public Route connectWithRegex(String path) { return route().method(HttpMethod.CONNECT).pathRegex(path); }
@Override public Route headWithRegex(String path) { return route().method(HttpMethod.HEAD).pathRegex(path); }
@Override public Route putWithRegex(String path) { return route().method(HttpMethod.PUT).pathRegex(path); }
@Override public Route patchWithRegex(String path) { return route().method(HttpMethod.PATCH).pathRegex(path); }
@Test public void testRoutePathAndMultipleMethodBuilderBegin() throws Exception { String path = "/blah"; router.route().path(path + "*").method(HttpMethod.GET).method(HttpMethod.POST).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end()); testPathBegin(HttpMethod.GET, path); testPathBegin(HttpMethod.POST, path); testRequest(HttpMethod.PUT, path, 404, "Not Found"); }
@Test public void testRoutePathAndMultipleMethodBuilder() throws Exception { String path = "/blah"; router.route().path(path).method(HttpMethod.GET).method(HttpMethod.POST).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end()); testPathExact(HttpMethod.GET, path); testPathExact(HttpMethod.POST, path); testRequest(HttpMethod.PUT, path, 404, "Not Found"); }
private void testRouteNoPathWithMethod(HttpMethod meth) throws Exception { router.clear(); router.route().method(meth).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end()); testNoPath(meth); for (HttpMethod m : METHODS) { if (m != meth) { testRequest(m, "/whatever", 404, "Not Found"); } } }
@Test public void testRoutePathAndMethodBuilder() throws Exception { String path = "/blah"; router.route().path(path).method(HttpMethod.GET).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end()); testPathExact(HttpMethod.GET, path); testRequest(HttpMethod.POST, path, 404, "Not Found"); }
@Test public void testRoutePathAndMethodBuilderBegin() throws Exception { String path = "/blah"; router.route().path(path + "*").method(HttpMethod.GET).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end()); testPathBegin(HttpMethod.GET, path); testRequest(HttpMethod.POST, path, 404, "Not Found"); }