i am trying this
router.put(/api).handler(TimeoutHandler.create(100,404)); router.put(/api).blockingHandler(this::handlebusinesslogic);
handlebusinesslogic{
Thread.sleep(1000);
reponse.setstatuscode(200);
reponse.end();}
still, I see 200 ok response instead of 404 response. is there something missing from the code. is there an alternative way to do this.
is there a way to set a general timeout for all HTTP requests?
That's because you shouldn't use
Thread.sleep()while testing anything in Vert.xIn your case, this will also block the timeout handler, preventing the timeout.
Here's how you should test it:
This example will return 404 as expected.