Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route calls next() after sending response #166

Open
beaverusiv opened this issue Dec 21, 2021 · 0 comments · May be fixed by #167
Open

Route calls next() after sending response #166

beaverusiv opened this issue Dec 21, 2021 · 0 comments · May be fixed by #167

Comments

@beaverusiv
Copy link

beaverusiv commented Dec 21, 2021

"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.

@beaverusiv beaverusiv linked a pull request Dec 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant