Skip to content

Route calls next() after sending response #166

@beaverusiv

Description

@beaverusiv
"express": "^4.17.2",
"typescript-rest": "^3.0.4",

I have a route in a service:

  @GET
  @Path("/")
  @PreProcessor(restAuthorise(all))
  getBulkConflictsForm(@HeaderParam("content-type") contentType = "") {
    return this.presenter.makeBulkConflictsForm(contentType === "application/json");
  }

As you can see it returns a value; a JSON representation of a form. So far, so good, when requesting the endpoint it returns 200 OK and the correct JSON. However:

  typescript-rest:service-invoker:runtime Sending a json value: {"links":[{"rel":"self","href":"https://proxy:4433/animal-genome/bulk-conflicts"},{"rel":"up","href":"https://proxy:4433/"}],"items":[{"id":"animalIds","name":"animalIds","description":"Array of animal Ids","type":"number"}]} +0ms
  express:router <anonymous>  : /animal-genome/bulk-conflicts +5ms
  express:router <anonymous>  : /animal-genome/bulk-conflicts +0ms
  express:router <anonymous>  : /animal-genome/bulk-conflicts +0ms
  express:router <anonymous>  : /animal-genome/bulk-conflicts +1ms
  finalhandler default 404 +3m
  finalhandler cannot 404 after headers sent +0ms

After sending the response the code looks to still call next(). As far as I can tell it shouldn't because I've returned a value from the service call, right? It should res.send() and be done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions