Closed theScottyJam closed 4 months ago
Hello there theScottyJam 👋
Thank you for opening your very first issue in this project.
We will try to get back to you as soon as we can.👀
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
I should be able to return a stream response via an injected error responder. (More generally, I just want to return arbitrary text in a response, but I understand that I can't do that unless I provide the text as a stream due to the fact that https://github.com/lukeautry/tsoa/issues/1394 was never resolved).
Current Behavior
Hitting that endpoint gives me the error:
The user performing the request gets a "204 No Content" response instead of the error.
Context (Environment)
Version of the library: 6.2.0 Version of NodeJS: V18.15.0
Detailed Description
If you comment out the
@Security()
decorator, then it'll work as expected. I guess the two don't play nice together?Also, if you add a
await new Promise(resolve => setTimeout(resolve, 1000))
between the timeforbiddenResponse()
gets called and when we return from the controller, like this:...then it'll work as expected.
Presumably there's a race condition going on, where the controller is trying to take the undefined return value and convert that to a response, but the
forbiddenResponse()
function is also trying to send a response at the same time, butforbiddenResponse()
will sometimes go too slow when it is given a stream. I don't really know how it's tied to the@Security()
decorator - I'm just guessing that it's somehow affecting the timing of events and exposing the race condition.Here's a dump of all of the files I'm using.
I'm running the project with