You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
used the search to make sure that a similar issue hasn't already been submit
Detailed Description
This is a request for clarification in the docs, and not a bug in the actual code.
The docs give examples for how to integrate tsoa with inversify (link). That part of the documentation also states that We usually don't want to create a new controller instance for every call, so let's create a convenience wrapper around @fluentProvide(), and provides an example of binding a controller to the IOC container in the singleton scope.
This is very reasonable — no point instantiating new controller instances if not necessary, so let's re-use the same instance for each request. However, since the Controller.setHeaders method mutates the controller state, calling setHeaders will modify the headers for every subsequent request to the same controller instance. This is pretty surprising, and took me a while to debug.
Would it be possible to clarify this behavior in the docs?
The text was updated successfully, but these errors were encountered:
Sorting
I'm submitting a ...
I confirm that I
Detailed Description
This is a request for clarification in the docs, and not a bug in the actual code.
The docs give examples for how to integrate
tsoa
withinversify
(link). That part of the documentation also states thatWe usually don't want to create a new controller instance for every call, so let's create a convenience wrapper around @fluentProvide()
, and provides an example of binding a controller to the IOC container in the singleton scope.This is very reasonable — no point instantiating new controller instances if not necessary, so let's re-use the same instance for each request. However, since the
Controller.setHeaders
method mutates the controller state, callingsetHeaders
will modify the headers for every subsequent request to the same controller instance. This is pretty surprising, and took me a while to debug.Would it be possible to clarify this behavior in the docs?
The text was updated successfully, but these errors were encountered: