title: Vertx throws "Response has already been written" IllegalStateException
body: <p>So, i'm learning how to use vertx right now, and I'm trying to serve an html file on a get request. When I actually do the request on my localhost, it serves the file, but in my console I get the error: </p>
  
  <p><strong>IllegalStateException: Response has already been written</strong></p>
  
  <p>Here is my code:</p>
  
  <pre><code>package com.techprimers.vertx;
  
  import io.vertx.core.Vertx;
  import io.vertx.core.http.HttpServer;
  import io.vertx.core.http.HttpServerResponse;
  import io.vertx.ext.web.Router;
  import io.vertx.ext.web.Route;
  
  class App {
      public static void main(String[] args) {
  
          Vertx vertx = Vertx.vertx();
  
          HttpServer httpServer = vertx.createHttpServer();
  
          Router router = Router.router(vertx);
  
          Route indexRoute = router
                  .get("/")
                  .handler(routingContext -&gt; {
                      HttpServerResponse response = routingContext.response();
                      response.setChunked(true);
                      response.sendFile("frontEnd/index.html");
                      response.end();
                  });
    httpServer
                  .requestHandler(router::accept)
                  .listen(8000);
  
      }
  }
  </code></pre>
  
  <p>And my file tree looks like this: </p>
  
  <p><a href="https://i.stack.imgur.com/eLNFI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eLNFI.png" alt="enter image description here"></a></p>
  
  <p>Any idea why this is happening?
  Thanks</p>