@Override public Route head(String path) { return router.head(path); }
@Override public Route head() { return router.head(); }
@Override public io.vertx.ext.web.Route head() { return delegate.head(); }
@Test public void testHead() throws Exception { router.head().handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.HEAD, "/whatever", 200, "foo"); testRequest(HttpMethod.GET, "/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/whatever", 404, "Not Found"); testRequest(HttpMethod.OPTIONS, "/whatever", 404, "Not Found"); testRequest(HttpMethod.DELETE, "/whatever", 404, "Not Found"); }
@Test public void testHeadWithPathExact() throws Exception { router.head("/somepath/").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.HEAD, "/somepath/", 200, "foo"); testRequest(HttpMethod.HEAD, "/otherpath/whatever", 404, "Not Found"); testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.DELETE, "/somepath/whatever", 404, "Not Found"); }
@Test public void testHeadWithPathBegin() throws Exception { router.head("/somepath/*").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.HEAD, "/somepath/whatever", 200, "foo"); testRequest(HttpMethod.HEAD, "/otherpath/whatever", 404, "Not Found"); testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.DELETE, "/somepath/whatever", 404, "Not Found"); }
/** * Add a route that matches any HTTP HEAD request * @return the route */ public io.vertx.rxjava.ext.web.Route head() { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.head()); return ret; }
/** * Add a route that matches any HTTP HEAD request * @return the route */ public io.vertx.rxjava.ext.web.Route head() { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.head()); return ret; }
/** * Add a route that matches a HTTP HEAD request and the specified path * @param path URI paths that begin with this path will match * @return the route */ public io.vertx.rxjava.ext.web.Route head(String path) { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.head(path)); return ret; }
/** * Add a route that matches a HTTP HEAD request and the specified path * @param path URI paths that begin with this path will match * @return the route */ public io.vertx.rxjava.ext.web.Route head(String path) { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.head(path)); return ret; }
@Override public io.vertx.ext.web.Route head(String path) { return delegate.head(getFullPath(path)); }
@Override public Router createRouter(Vertx vertx) { Router router = Router.router(vertx); router.get("/").handler(this::onInfo); router.head("/").handler(this::onPing); router.options("/").handler(this::onOptions); return router; }
break; case HEAD: route = router.head(s); break; case PATCH:
@Test public void testHead() throws Exception { router.head().handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.HEAD, "/whatever", 200, "foo"); testRequest(HttpMethod.GET, "/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/whatever", 404, "Not Found"); testRequest(HttpMethod.OPTIONS, "/whatever", 404, "Not Found"); testRequest(HttpMethod.DELETE, "/whatever", 404, "Not Found"); }
@Test public void testHeadWithPathExact() throws Exception { router.head("/somepath/").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.HEAD, "/somepath/", 200, "foo"); testRequest(HttpMethod.HEAD, "/otherpath/whatever", 404, "Not Found"); testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.DELETE, "/somepath/whatever", 404, "Not Found"); }
@Test public void testHeadWithPathBegin() throws Exception { router.head("/somepath/*").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.HEAD, "/somepath/whatever", 200, "foo"); testRequest(HttpMethod.HEAD, "/otherpath/whatever", 404, "Not Found"); testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.DELETE, "/somepath/whatever", 404, "Not Found"); }